knitkit 2.1.3 → 2.1.4
Sign up to get free protection for your applications and to get access to all the features.
- data/app/controllers/knitkit/base_controller.rb +1 -0
- data/app/controllers/knitkit/erp_app/desktop/app_controller.rb +2 -0
- data/app/controllers/knitkit/erp_app/desktop/content_controller.rb +2 -2
- data/app/controllers/knitkit/erp_app/desktop/website_nav_controller.rb +17 -7
- data/app/controllers/knitkit/erp_app/desktop/website_section_controller.rb +8 -1
- data/app/controllers/knitkit/online_document_sections_controller.rb +25 -17
- data/app/models/documented_content.rb +3 -3
- data/app/models/online_document_section.rb +1 -0
- data/app/models/published_website.rb +18 -11
- data/app/models/website.rb +49 -28
- data/app/models/website_nav_item.rb +12 -0
- data/app/models/website_section.rb +1 -3
- data/app/views/knitkit/online_document_sections/index.html.erb +77 -46
- data/app/views/layouts/knitkit/online_document_sections.html.erb +13 -14
- data/app/widgets/login/base.rb +1 -1
- data/config/routes.rb +1 -1
- data/db/migrate/20110211002317_setup_knitkit.rb +1 -0
- data/db/migrate/20130405184234_add_use_markdown_to_section.rb +19 -0
- data/lib/knitkit/extensions/railties/action_view/helpers/knitkit_helper.rb +1 -1
- data/lib/knitkit/extensions/railties/action_view/helpers/menu_helper.rb +0 -1
- data/lib/knitkit/version.rb +1 -1
- data/public/javascripts/erp_app/desktop/applications/knitkit/articles_grid_panel.js +1 -0
- data/public/javascripts/erp_app/desktop/applications/knitkit/center_region.js +109 -26
- data/public/javascripts/erp_app/desktop/applications/knitkit/section_articles_grid_panel.js +60 -61
- data/public/javascripts/erp_app/desktop/applications/knitkit/west_region/helpers/document.js +26 -0
- data/public/javascripts/erp_app/desktop/applications/knitkit/west_region/helpers/menu.js +3 -2
- data/public/javascripts/erp_app/desktop/applications/knitkit/west_region/helpers/section.js +9 -24
- data/public/javascripts/erp_app/desktop/applications/knitkit/west_region/helpers/website_nav_items.js +232 -248
- data/public/javascripts/erp_app/desktop/applications/knitkit/west_region/west_region.js +33 -43
- metadata +19 -3
- data/public/stylesheets/knitkit/documentation.css +0 -50
@@ -4,13 +4,12 @@
|
|
4
4
|
<script type="text/javascript" charset="utf-8">
|
5
5
|
|
6
6
|
Ext.onReady(function () {
|
7
|
-
var
|
8
|
-
var currentItem;
|
7
|
+
var currentItem, tree, tabs, fitted_panel;
|
9
8
|
|
10
|
-
|
9
|
+
tree = Ext.create('Ext.tree.Panel', {
|
11
10
|
region: 'west',
|
12
11
|
cls: 'tree_styles',
|
13
|
-
store: Ext.create('Ext.data.TreeStore',{
|
12
|
+
store: Ext.create('Ext.data.TreeStore', {
|
14
13
|
proxy: {
|
15
14
|
type: 'ajax',
|
16
15
|
url: 'online_document_sections/build_tree',
|
@@ -25,20 +24,20 @@
|
|
25
24
|
fields: [
|
26
25
|
{ name: 'id' },
|
27
26
|
{ name: 'title' },
|
28
|
-
{ name: 'documented_item_published_content_html' },
|
29
27
|
{ name: 'leaf' }
|
30
28
|
]
|
31
29
|
}),
|
32
30
|
collapsible: true,
|
33
|
-
|
31
|
+
dockedItems: {
|
32
|
+
xtype: 'toolbar',
|
33
|
+
docked: 'top',
|
34
34
|
items: [
|
35
|
-
|
36
|
-
|
37
|
-
disabled: true,
|
38
|
-
cls: 'document_search',
|
35
|
+
{
|
36
|
+
xtype: 'textfield',
|
39
37
|
emptyText: 'Search',
|
40
|
-
|
41
|
-
|
38
|
+
disabled: true,
|
39
|
+
allowBlank: true
|
40
|
+
}
|
42
41
|
]
|
43
42
|
},
|
44
43
|
header: false,
|
@@ -51,40 +50,23 @@
|
|
51
50
|
title: '<%= @root.title %>',
|
52
51
|
listeners: {
|
53
52
|
'itemclick': function (view, record, htmlItem, index, e) {
|
54
|
-
var tab_panel = Ext.getCmp('tabs_root')
|
55
|
-
|
56
|
-
|
57
|
-
tab_panel.setActiveTab(tab.id);
|
58
|
-
}
|
59
|
-
else {
|
60
|
-
addTab(record);
|
61
|
-
}
|
53
|
+
var tab_panel = Ext.getCmp('tabs_root'),
|
54
|
+
tab = Ext.getCmp("tab_" + record.data['id']);
|
55
|
+
showContent(record, tab);
|
62
56
|
}
|
63
57
|
}
|
64
58
|
});
|
65
59
|
|
66
|
-
|
60
|
+
tabs = Ext.createWidget('tabpanel', {
|
67
61
|
id: 'tabs_root',
|
68
62
|
region: 'center',
|
69
63
|
plain: true,
|
70
64
|
bodyBorder: true,
|
71
|
-
resizeTabs: true,
|
72
|
-
enableTabScroll: true,
|
73
|
-
width: 640,
|
74
|
-
collapsible: false,
|
75
65
|
defaults: {
|
76
66
|
autoScroll: true,
|
77
|
-
bodyPadding: 10
|
67
|
+
bodyPadding: 10
|
78
68
|
},
|
79
|
-
items: [
|
80
|
-
{
|
81
|
-
id: "tab_" + <%= @root.id.to_s %>,
|
82
|
-
title: '<%= @root.title %>',
|
83
|
-
html: "<%= raw @root_content.gsub(/\n/, '<br/>') %>",
|
84
|
-
closable: false,
|
85
|
-
autoScroll: true
|
86
|
-
}
|
87
|
-
],
|
69
|
+
items: [],
|
88
70
|
plugins: Ext.create('Ext.ux.TabCloseMenu', {
|
89
71
|
extraItemsTail: [
|
90
72
|
'-',
|
@@ -110,26 +92,49 @@
|
|
110
92
|
})
|
111
93
|
});
|
112
94
|
|
113
|
-
function
|
114
|
-
|
115
|
-
|
116
|
-
|
117
|
-
|
118
|
-
|
119
|
-
|
120
|
-
|
95
|
+
function showContent(record, tab) {
|
96
|
+
Ext.Ajax.request({
|
97
|
+
url: 'online_document_sections/get_content',
|
98
|
+
params: {
|
99
|
+
document_section_id: record.data['id'],
|
100
|
+
section_id:<%= @root.id %>
|
101
|
+
},
|
102
|
+
success: function (response) {
|
103
|
+
var responseObj = Ext.JSON.decode(response.responseText);
|
104
|
+
if (responseObj.success) {
|
105
|
+
if (Ext.isEmpty(tab)) {
|
106
|
+
tabs.add({
|
107
|
+
id: "tab_" + record.data['id'],
|
108
|
+
title: record.data['title'],
|
109
|
+
html: responseObj.html,
|
110
|
+
closable: true
|
111
|
+
}).show();
|
112
|
+
}
|
113
|
+
else {
|
114
|
+
tabs.setActiveTab(tab);
|
115
|
+
tab.update(responseObj.html)
|
116
|
+
}
|
117
|
+
}
|
118
|
+
else {
|
119
|
+
Ext.Msg.alert('Error', 'Could not load content');
|
120
|
+
}
|
121
|
+
},
|
122
|
+
failure: function (response) {
|
123
|
+
Ext.Msg.alert('Error', 'Could not load content');
|
124
|
+
}
|
125
|
+
});
|
121
126
|
}
|
122
127
|
|
123
|
-
|
128
|
+
fitted_panel = Ext.createWidget('panel', {
|
124
129
|
id: 'fitted_panel',
|
125
130
|
layout: 'border',
|
131
|
+
width: 800,
|
126
132
|
header: false,
|
127
133
|
defaults: {
|
128
134
|
collapsible: true,
|
129
|
-
split: true
|
135
|
+
split: true
|
130
136
|
},
|
131
137
|
renderTo: 'document_content',
|
132
|
-
autoScroll: true,
|
133
138
|
items: [
|
134
139
|
tree,
|
135
140
|
tabs
|
@@ -137,7 +142,33 @@
|
|
137
142
|
});
|
138
143
|
|
139
144
|
resize_windows();
|
145
|
+
});
|
140
146
|
|
147
|
+
Ext.Ajax.request({
|
148
|
+
url: 'online_document_sections/get_content',
|
149
|
+
params: {
|
150
|
+
document_section_id:<%= @root.id %>,
|
151
|
+
section_id:<%= @root.id %>
|
152
|
+
},
|
153
|
+
success: function (response) {
|
154
|
+
var responseObj = Ext.JSON.decode(response.responseText);
|
155
|
+
if (responseObj.success) {
|
156
|
+
Ext.getCmp('tabs_root').add({
|
157
|
+
xtype: 'panel',
|
158
|
+
id: "tab_" + <%= @root.id.to_s %>,
|
159
|
+
title: '<%= @root.title %>',
|
160
|
+
html: responseObj.html,
|
161
|
+
closable: false,
|
162
|
+
autoScroll: true
|
163
|
+
});
|
164
|
+
}
|
165
|
+
else {
|
166
|
+
Ext.Msg.alert('Error', 'Could not load content');
|
167
|
+
}
|
168
|
+
},
|
169
|
+
failure: function (response) {
|
170
|
+
Ext.Msg.alert('Error', 'Could not load content');
|
171
|
+
}
|
141
172
|
});
|
142
173
|
|
143
174
|
function resize_windows() {
|
@@ -3,32 +3,26 @@
|
|
3
3
|
<head>
|
4
4
|
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />
|
5
5
|
<meta name="generator" content="Knitkit - Compass AE Open source content management platform" />
|
6
|
-
|
6
|
+
|
7
7
|
<meta name="description" content="" />
|
8
8
|
<meta name="keywords" content="" />
|
9
9
|
<meta name="copyright" content="©" />
|
10
10
|
<meta name="robots" content="ALL" />
|
11
11
|
<meta name="language" content="English" />
|
12
|
-
|
12
|
+
|
13
13
|
<title><%= @website.title %></title>
|
14
14
|
<%= javascript_include_tag :application %>
|
15
15
|
<%= include_extjs :theme => 'extjs:ext-all-gray' %>
|
16
|
-
<%=
|
16
|
+
<%= set_erp_tech_config_vars %>
|
17
|
+
<%= static_javascript_include_tag('erp_app/utility.js') %>
|
17
18
|
<%= static_javascript_include_tag('erp_app/jquery_support.js') %>
|
18
19
|
<%= static_javascript_include_tag('datepicker.js') %>
|
19
20
|
<%= static_stylesheet_link_tag('datepicker.css') %>
|
20
|
-
<%=
|
21
|
+
<%= static_stylesheet_link_tag('extjs/resources/css/knitkit_extjs_4.css') %>
|
21
22
|
<%= static_stylesheet_link_tag('knitkit/style.css') %>
|
22
23
|
<%= static_javascript_include_tag('erp_app/widgets.js') %>
|
23
|
-
|
24
|
-
<%= static_javascript_include_tag('erp_app/shared/dynamic_forms/dynamic_forms_validation.js') %>
|
25
|
-
<%= static_stylesheet_link_tag('knitkit/documentation.css') %>
|
24
|
+
|
26
25
|
<%= yield :head %>
|
27
|
-
<!--[if !IE 7]>
|
28
|
-
<style type="text/css">
|
29
|
-
#main {display:table;height:100%}
|
30
|
-
</style>
|
31
|
-
<![endif]-->
|
32
26
|
</head>
|
33
27
|
<body>
|
34
28
|
<div id="main">
|
@@ -48,8 +42,13 @@
|
|
48
42
|
<%= content_for?(:menu) ? yield(:menu) : render_menu(@contents) %>
|
49
43
|
<%#=render_menu(@contents, :menu => 'main')%>
|
50
44
|
</div>
|
51
|
-
|
52
|
-
|
45
|
+
<div id="site_content">
|
46
|
+
<%=build_crumbs %>
|
47
|
+
<br/>
|
48
|
+
<div id="content">
|
49
|
+
<%= yield %>
|
50
|
+
</div>
|
51
|
+
</div>
|
53
52
|
</div>
|
54
53
|
<div id="content_footer"></div>
|
55
54
|
<%= content_for?(:footer) ? yield(:footer) : (render :partial => 'shared/knitkit/footer') %>
|
data/app/widgets/login/base.rb
CHANGED
data/config/routes.rb
CHANGED
@@ -11,7 +11,7 @@ Rails.application.routes.draw do
|
|
11
11
|
match '/comments/add' => 'knitkit/comments#add', :as => 'comments'
|
12
12
|
match '/unauthorized' => 'knitkit/unauthorized#index', :as => 'knitkit/unauthorized'
|
13
13
|
match '/view_current_publication' => 'knitkit/base#view_current_publication'
|
14
|
-
match '/online_document_sections
|
14
|
+
match '/online_document_sections(/:action)' => 'knitkit/online_document_sections'
|
15
15
|
end
|
16
16
|
|
17
17
|
Knitkit::Engine.routes.draw do
|
@@ -46,6 +46,7 @@ class SetupKnitkit < ActiveRecord::Migration
|
|
46
46
|
t.text :layout
|
47
47
|
t.boolean :in_menu
|
48
48
|
t.integer :position, :default => 0
|
49
|
+
t.boolean :use_markdown, :default => false
|
49
50
|
t.string :internal_identifier
|
50
51
|
t.integer :version
|
51
52
|
t.boolean :render_base_layout, :default => true
|
@@ -0,0 +1,19 @@
|
|
1
|
+
class AddUseMarkdownToSection < ActiveRecord::Migration
|
2
|
+
def self.up
|
3
|
+
unless columns(:website_sections).collect {|c| c.name}.include?('use_markdown')
|
4
|
+
add_column :website_sections, :use_markdown, :boolean
|
5
|
+
|
6
|
+
WebsiteSection.all.each do |section|
|
7
|
+
section.use_markdown = false
|
8
|
+
section.save
|
9
|
+
end
|
10
|
+
|
11
|
+
end
|
12
|
+
end
|
13
|
+
|
14
|
+
def self.down
|
15
|
+
if columns(:website_sections).collect {|c| c.name}.include?('use_markdown')
|
16
|
+
remove_column :website_sections, :use_markdown
|
17
|
+
end
|
18
|
+
end
|
19
|
+
end
|
@@ -45,7 +45,7 @@ module Knitkit
|
|
45
45
|
raise "Website Section with that Internal ID does not exist" if section.nil?
|
46
46
|
links = section.self_and_ancestors.map{|child| {:url => child.path, :title => child.title}}
|
47
47
|
else
|
48
|
-
links = @website_section.self_and_ancestors.collect{|child| {:url => child.path, :title => child.title}}
|
48
|
+
links = @website_section.nil? ? [] : @website_section.self_and_ancestors.collect{|child| {:url => child.path, :title => child.title}}
|
49
49
|
end
|
50
50
|
|
51
51
|
render :partial => 'shared/knitkit/bread_crumb', :locals => {:links => links}
|
@@ -54,7 +54,6 @@ module Knitkit
|
|
54
54
|
layout = options[:layout] ? "menus/#{options[:layout]}" : "menus/knitkit/default_sub_menu"
|
55
55
|
else
|
56
56
|
section = options[:section_unique_name].nil? ? @website_section : WebsiteSection.find_by_internal_identifier(options[:section_unique_name])
|
57
|
-
raise "No website sections exist" if section.nil?
|
58
57
|
locals[:section] = section
|
59
58
|
layout = options[:layout] ? "menus/#{options[:layout]}" : "menus/knitkit/default_sub_section_menu"
|
60
59
|
end
|
data/lib/knitkit/version.rb
CHANGED
@@ -42,6 +42,8 @@ Ext.define("Compass.ErpApp.Desktop.Applications.Knitkit.CenterRegion", {
|
|
42
42
|
return false;
|
43
43
|
},
|
44
44
|
|
45
|
+
/* sections */
|
46
|
+
|
45
47
|
saveSectionLayout:function (sectionId, content) {
|
46
48
|
var self = this;
|
47
49
|
this.setWindowStatus('Saving...');
|
@@ -127,6 +129,96 @@ Ext.define("Compass.ErpApp.Desktop.Applications.Knitkit.CenterRegion", {
|
|
127
129
|
return false;
|
128
130
|
},
|
129
131
|
|
132
|
+
/* documentation using markdown */
|
133
|
+
|
134
|
+
saveDocumentationMarkdown:function (id, siteId, content) {
|
135
|
+
var self = this;
|
136
|
+
this.setWindowStatus('Saving...');
|
137
|
+
Ext.Ajax.request({
|
138
|
+
url:'/knitkit/erp_app/desktop/content/update',
|
139
|
+
method:'POST',
|
140
|
+
params:{
|
141
|
+
id:id,
|
142
|
+
html:content,
|
143
|
+
site_id:siteId
|
144
|
+
},
|
145
|
+
success:function (response) {
|
146
|
+
var obj = Ext.decode(response.responseText);
|
147
|
+
if (obj.success) {
|
148
|
+
self.clearWindowStatus();
|
149
|
+
Ext.getStore('knitkit_articlesgridpanelStore').load();
|
150
|
+
var activeTab = self.workArea.getActiveTab();
|
151
|
+
var versionsGrid = activeTab.down('knitkit_versionsarticlegridpanel');
|
152
|
+
versionsGrid.getStore().load();
|
153
|
+
}
|
154
|
+
else {
|
155
|
+
Ext.Msg.alert('Error', 'Error saving contents');
|
156
|
+
self.clearWindowStatus();
|
157
|
+
}
|
158
|
+
},
|
159
|
+
failure:function (response) {
|
160
|
+
self.clearWindowStatus();
|
161
|
+
Ext.Msg.alert('Error', 'Error saving contents');
|
162
|
+
}
|
163
|
+
});
|
164
|
+
},
|
165
|
+
|
166
|
+
editDocumentationMarkdown:function (sectionName, websiteId, contentId, content, tbarItems) {
|
167
|
+
var self = this;
|
168
|
+
var itemId = 'markdown-' + contentId;
|
169
|
+
var item = this.workArea.query('#' + itemId).first();
|
170
|
+
|
171
|
+
if (Compass.ErpApp.Utility.isBlank(item)) {
|
172
|
+
item = Ext.create("Ext.panel.Panel", {
|
173
|
+
layout:'border',
|
174
|
+
title:sectionName,
|
175
|
+
save:function (comp) {
|
176
|
+
var content = comp.down('codemirror').getValue();
|
177
|
+
self.saveDocumentationMarkdown(contentId, websiteId, content);
|
178
|
+
},
|
179
|
+
closable:true,
|
180
|
+
itemId:itemId,
|
181
|
+
items:[
|
182
|
+
{
|
183
|
+
title:sectionName + ' - Markdown',
|
184
|
+
tbarItems:tbarItems,
|
185
|
+
disableSave:true,
|
186
|
+
listeners:{
|
187
|
+
save:function (comp, content) {
|
188
|
+
self.saveDocumentationMarkdown(contentId, websiteId, content);
|
189
|
+
}
|
190
|
+
},
|
191
|
+
xtype:'codemirror',
|
192
|
+
parser:'erb',
|
193
|
+
region:'center',
|
194
|
+
sourceCode:content
|
195
|
+
},
|
196
|
+
{
|
197
|
+
xtype:'knitkit_versionsarticlegridpanel',
|
198
|
+
contentId:contentId,
|
199
|
+
region:'south',
|
200
|
+
height:150,
|
201
|
+
collapsible:true,
|
202
|
+
centerRegion:self,
|
203
|
+
siteId:websiteId
|
204
|
+
}
|
205
|
+
],
|
206
|
+
listeners:{
|
207
|
+
'show':function (panel) {
|
208
|
+
Ext.getCmp('knitkitWestRegion').selectWebsite(websiteId);
|
209
|
+
}
|
210
|
+
}
|
211
|
+
});
|
212
|
+
|
213
|
+
this.workArea.add(item);
|
214
|
+
}
|
215
|
+
|
216
|
+
this.workArea.setActiveTab(item);
|
217
|
+
return false;
|
218
|
+
},
|
219
|
+
|
220
|
+
/* templates */
|
221
|
+
|
130
222
|
saveTemplateFile:function (path, content) {
|
131
223
|
var self = this;
|
132
224
|
this.setWindowStatus('Saving...');
|
@@ -191,6 +283,8 @@ Ext.define("Compass.ErpApp.Desktop.Applications.Knitkit.CenterRegion", {
|
|
191
283
|
return false;
|
192
284
|
},
|
193
285
|
|
286
|
+
/* excerpts */
|
287
|
+
|
194
288
|
saveExcerpt:function (id, content, siteId) {
|
195
289
|
var self = this;
|
196
290
|
this.setWindowStatus('Saving...');
|
@@ -206,9 +300,10 @@ Ext.define("Compass.ErpApp.Desktop.Applications.Knitkit.CenterRegion", {
|
|
206
300
|
var obj = Ext.decode(response.responseText);
|
207
301
|
if (obj.success) {
|
208
302
|
self.clearWindowStatus();
|
303
|
+
Ext.getStore('knitkit_articlesgridpanelStore').load();
|
209
304
|
var activeTab = self.workArea.getActiveTab();
|
210
305
|
var panel = activeTab.query('knitkit_versionsbloggridpanel');
|
211
|
-
if (panel.length
|
306
|
+
if (panel.length === 0) {
|
212
307
|
panel = activeTab.query('knitkit_nonpublishedversionswebsitesectiongridpanel');
|
213
308
|
}
|
214
309
|
panel[0].getStore().load();
|
@@ -241,8 +336,7 @@ Ext.define("Compass.ErpApp.Desktop.Applications.Knitkit.CenterRegion", {
|
|
241
336
|
listeners:{
|
242
337
|
save:function (comp, content) {
|
243
338
|
self.saveExcerpt(id, content, siteId);
|
244
|
-
if (contentGridStore)
|
245
|
-
contentGridStore.load();
|
339
|
+
if (!Ext.isEmpty(contentGridStore)) contentGridStore.load();
|
246
340
|
}
|
247
341
|
}
|
248
342
|
});
|
@@ -289,7 +383,7 @@ Ext.define("Compass.ErpApp.Desktop.Applications.Knitkit.CenterRegion", {
|
|
289
383
|
if (currentUser.hasCapability('edit_html', 'Content')) {
|
290
384
|
var content = comp.down('ckeditor').getValue();
|
291
385
|
self.saveExcerpt(id, content, siteId);
|
292
|
-
contentGridStore.load();
|
386
|
+
if (!Ext.isEmpty(contentGridStore)) contentGridStore.load();
|
293
387
|
} else {
|
294
388
|
currentUser.showInvalidAccess();
|
295
389
|
}
|
@@ -310,6 +404,7 @@ Ext.define("Compass.ErpApp.Desktop.Applications.Knitkit.CenterRegion", {
|
|
310
404
|
this.workArea.setActiveTab(item);
|
311
405
|
},
|
312
406
|
|
407
|
+
/* image */
|
313
408
|
|
314
409
|
showImage:function (node, themeId) {
|
315
410
|
var self = this;
|
@@ -334,6 +429,8 @@ Ext.define("Compass.ErpApp.Desktop.Applications.Knitkit.CenterRegion", {
|
|
334
429
|
return false;
|
335
430
|
},
|
336
431
|
|
432
|
+
/* content */
|
433
|
+
|
337
434
|
saveContent:function (id, content, contentType, siteId) {
|
338
435
|
var self = this;
|
339
436
|
this.setWindowStatus('Saving...');
|
@@ -349,6 +446,7 @@ Ext.define("Compass.ErpApp.Desktop.Applications.Knitkit.CenterRegion", {
|
|
349
446
|
var obj = Ext.decode(response.responseText);
|
350
447
|
if (obj.success) {
|
351
448
|
self.clearWindowStatus();
|
449
|
+
Ext.getStore('knitkit_articlesgridpanelStore').load();
|
352
450
|
if (!Compass.ErpApp.Utility.isBlank(contentType)) {
|
353
451
|
var activeTab = self.workArea.getActiveTab();
|
354
452
|
var versionsGrid = activeTab.down('knitkit_versions' + contentType + 'gridpanel');
|
@@ -414,8 +512,7 @@ Ext.define("Compass.ErpApp.Desktop.Applications.Knitkit.CenterRegion", {
|
|
414
512
|
listeners:{
|
415
513
|
save:function (comp, content) {
|
416
514
|
self.saveContent(id, content, contentType, siteId);
|
417
|
-
if (contentGridStore)
|
418
|
-
contentGridStore.load();
|
515
|
+
if (!Ext.isEmpty(contentGridStore)) contentGridStore.load();
|
419
516
|
}
|
420
517
|
}
|
421
518
|
});
|
@@ -489,6 +586,8 @@ Ext.define("Compass.ErpApp.Desktop.Applications.Knitkit.CenterRegion", {
|
|
489
586
|
this.workArea.setActiveTab(item);
|
490
587
|
},
|
491
588
|
|
589
|
+
/* comment */
|
590
|
+
|
492
591
|
showComment:function (comment) {
|
493
592
|
var activeTab = this.workArea.getActiveTab();
|
494
593
|
var cardPanel = activeTab.query('panel')[0];
|
@@ -584,7 +683,7 @@ Ext.define("Compass.ErpApp.Desktop.Applications.Knitkit.CenterRegion", {
|
|
584
683
|
Ext.Msg.alert('Error', 'No editor');
|
585
684
|
}
|
586
685
|
else {
|
587
|
-
if (activeTab.query('ckeditor').length
|
686
|
+
if (activeTab.query('ckeditor').length === 0) {
|
588
687
|
Ext.Msg.alert('Error', 'No ckeditor found');
|
589
688
|
}
|
590
689
|
else {
|
@@ -600,7 +699,7 @@ Ext.define("Compass.ErpApp.Desktop.Applications.Knitkit.CenterRegion", {
|
|
600
699
|
Ext.Msg.alert('Error', 'No editor');
|
601
700
|
}
|
602
701
|
else {
|
603
|
-
if (activeTab.query('ckeditor').length
|
702
|
+
if (activeTab.query('ckeditor').length === 0) {
|
604
703
|
Ext.Msg.alert('Error', 'No ckeditor found');
|
605
704
|
}
|
606
705
|
else {
|
@@ -616,7 +715,7 @@ Ext.define("Compass.ErpApp.Desktop.Applications.Knitkit.CenterRegion", {
|
|
616
715
|
Ext.Msg.alert('Error', 'No editor');
|
617
716
|
}
|
618
717
|
else {
|
619
|
-
if (activeTab.query('codemirror').length
|
718
|
+
if (activeTab.query('codemirror').length === 0) {
|
620
719
|
Ext.Msg.alert('Error', 'No codemirror found.');
|
621
720
|
}
|
622
721
|
else {
|
@@ -632,7 +731,7 @@ Ext.define("Compass.ErpApp.Desktop.Applications.Knitkit.CenterRegion", {
|
|
632
731
|
Ext.Msg.alert('Error', 'No editor');
|
633
732
|
}
|
634
733
|
else {
|
635
|
-
if (activeTab.query('codemirror').length
|
734
|
+
if (activeTab.query('codemirror').length === 0) {
|
636
735
|
Ext.Msg.alert('Error', 'No codemirror found. Note that a widget can only be added to a Layout.');
|
637
736
|
}
|
638
737
|
else {
|
@@ -664,22 +763,6 @@ Ext.define("Compass.ErpApp.Desktop.Applications.Knitkit.CenterRegion", {
|
|
664
763
|
return false;
|
665
764
|
},
|
666
765
|
|
667
|
-
insertHtmlIntoActiveCkEditor:function (html) {
|
668
|
-
var activeTab = this.workArea.getActiveTab();
|
669
|
-
if (Compass.ErpApp.Utility.isBlank(activeTab)) {
|
670
|
-
Ext.Msg.alert('Error', 'No editor');
|
671
|
-
}
|
672
|
-
else {
|
673
|
-
if (activeTab.query('ckeditor').length == 0) {
|
674
|
-
Ext.Msg.alert('Error', 'No ckeditor found');
|
675
|
-
}
|
676
|
-
else {
|
677
|
-
activeTab.query('ckeditor')[0].insertHtml(html);
|
678
|
-
}
|
679
|
-
}
|
680
|
-
return false;
|
681
|
-
},
|
682
|
-
|
683
766
|
saveCurrent:function () {
|
684
767
|
var activeTab = this.workArea.getActiveTab();
|
685
768
|
if (!Ext.isEmpty(activeTab) && !Ext.isEmpty(activeTab.initialConfig.save)) {
|