Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

FIX Missing shortcode field and broken Javascript when inserting document #194

Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 3 additions & 2 deletions code/cms/DMSDocumentAddExistingField.php
Original file line number Diff line number Diff line change
Expand Up @@ -54,8 +54,9 @@ public function FieldHolder($properties = array())

public function Field($properties = array())
{
Requirements::javascript(DMS_DIR.'/javascript/DMSDocumentAddExistingField.js');
Requirements::javascript(DMS_DIR."/javascript/DocumentHtmlEditorFieldToolbar.js");
Requirements::javascript(DMS_DIR . '/javascript/DMSDocumentAddExistingField.js');
Requirements::javascript(DMS_DIR . '/javascript/DocumentHtmlEditorFieldToolbar.js');
Requirements::css(DMS_DIR . '/dist/css/cmsbundle.css');

return $this->renderWith('DMSDocumentAddExistingField');
}
Expand Down
2 changes: 2 additions & 0 deletions code/cms/DocumentHtmlEditorFieldToolbar.php
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,8 @@ public function updateLinkForm(Form $form)
$addExistingField->setUseFieldClass(false);
$fieldList->insertAfter($addExistingField, 'Description');

$fieldList->push(HiddenField::create('DMSShortcodeHandlerKey', false, DMS::inst()->getShortcodeHandlerKey()));

// Requirements::javascript(SAPPHIRE_DIR . "/thirdparty/behaviour/behaviour.js");
// Requirements::javascript(SAPPHIRE_DIR . "/javascript/tiny_mce_improvements.js");
//
Expand Down
28 changes: 15 additions & 13 deletions dist/css/cmsbundle.css
Original file line number Diff line number Diff line change
Expand Up @@ -172,13 +172,13 @@ form.small .field .TreeDropdownField,
.ss-add .document-add-existing .treedropdownfield-toggle-panel-link {
padding: 5px 9px 9px;
background: #fff;
border: 1px solid #B3B3B3;
border: 1px solid #b3b3b3;
float: right;
z-index: 99999;
position: relative; }
.ss-add .document-add-existing .treedropdownfield-toggle-panel-link.treedropdownfield-open-tree {
background: #fff;
border: 1px solid #B3B3B3;
border: 1px solid #b3b3b3;
border-bottom: none;
border-bottom-right-radius: 0; }

Expand Down Expand Up @@ -228,16 +228,18 @@ form.small .field .TreeDropdownField,
font-weight: bold;
text-shadow: 1px 1px 0 white; }

.ss-add .document-add-existing.link-editor-context .middleColumn {
margin-left: 184px; }
.ss-add .document-add-existing.link-editor-context .middleColumn input {
background: white;
border: 1px solid #B3B3B3;
line-height: 16px;
margin: 0;
border-radius: 4px;
background-size: 100%;
max-width: 512px; }
.ss-add .document-add-existing.link-editor-context .middleColumn input {
background: white;
border: 1px solid #b3b3b3;
line-height: 16px;
border-radius: 4px;
background-size: 100%;
max-width: 468px; }
.ss-add .document-add-existing.link-editor-context .middleColumn input.document-autocomplete {
max-width: 365px; }

.ss-add .document-add-existing.link-editor-context .document-list {
width: calc(100% - 2px); }

.ss-add .ss-assetuploadfield.link-editor-context label {
float: left;
Expand Down Expand Up @@ -314,7 +316,7 @@ form.small .field .TreeDropdownField,
margin-top: 13px;
padding: 10px;
background: white;
border: 1px solid #B3B3B3; }
border: 1px solid #b3b3b3; }
#Form_ItemEditForm ul.SelectionGroup li.selected label.ui-button:after {
top: 43px; }
#Form_ItemEditForm ul.SelectionGroup .treedropdownfield-panel {
Expand Down
2 changes: 1 addition & 1 deletion javascript/DocumentHtmlEditorFieldToolbar.js
Original file line number Diff line number Diff line change
Expand Up @@ -92,7 +92,7 @@
}

// Match a document or call the regular link handling
if (href.match(new RegExp("/^\[" + this.getShortcodeKey() + "(\s*|%20|,)?id=([0-9]+)\]?$/", "i"))) {
if (href.match(new RegExp('^\\[' + this.getShortcodeKey() + '(\s*|%20|,)?id=([0-9]+)\\]?$', 'i'))) {
var returnArray = {
LinkType: 'document',
DocumentID: RegExp.$2,
Expand Down
2 changes: 2 additions & 0 deletions scss/_variables.scss
Original file line number Diff line number Diff line change
Expand Up @@ -8,3 +8,5 @@ $color-grey-lighter: #f8f8f8 !default;
$color-grey-light: #d0d3d5 !default;
$color-grey-dark: #66727d !default;
$color-white: #ffffff !default;

$color-cms-input-border: #b3b3b3 !default;
22 changes: 14 additions & 8 deletions scss/upload.scss
Original file line number Diff line number Diff line change
Expand Up @@ -37,14 +37,14 @@
.treedropdownfield-toggle-panel-link {
padding: 5px 9px 9px;
background: #fff;
border: 1px solid #B3B3B3;
border: 1px solid $color-cms-input-border;
float: right;
z-index: 99999;
position: relative;

&.treedropdownfield-open-tree {
background: #fff;
border: 1px solid #B3B3B3;
border: 1px solid $color-cms-input-border;
border-bottom:none;
border-bottom-right-radius:0;
}
Expand Down Expand Up @@ -100,6 +100,7 @@
}
}

// When inserting a link to a document via the TinyMCE editor
&.link-editor-context {
label {
float: left;
Expand All @@ -112,18 +113,23 @@
}

.middleColumn {
margin-left: 184px;

input {
background: white;
border: 1px solid #B3B3B3;
border: 1px solid $color-cms-input-border;
line-height: 16px;
margin: 0;
border-radius: 4px;
background-size: 100%;
max-width: 512px;
max-width: 468px;

&.document-autocomplete {
max-width: 365px;
}
}
}

.document-list {
width: calc(100% - 2px);
}
}
}

Expand Down Expand Up @@ -234,7 +240,7 @@
margin-top: 13px;
padding: 10px;
background: white;
border: 1px solid #B3B3B3;
border: 1px solid $color-cms-input-border;
}

&.selected {
Expand Down