knitkit 2.1.12 → 2.1.13
Sign up to get free protection for your applications and to get access to all the features.
- data/app/models/content.rb +5 -4
- data/app/models/website.rb +1 -4
- data/app/widgets/manage_profile/base.rb +4 -1
- data/lib/knitkit/engine.rb +1 -1
- data/lib/knitkit/extensions/railties/action_view/helpers/content_helper.rb +4 -2
- data/lib/knitkit/version.rb +1 -1
- data/public/javascripts/erp_app/desktop/applications/knitkit/west_region/helpers/website_nav_items.js +235 -232
- data/public/javascripts/erp_app/desktop/applications/knitkit/west_region/west_region.js +1 -1
- metadata +2 -2
data/app/models/content.rb
CHANGED
@@ -29,25 +29,26 @@ class Content < ActiveRecord::Base
|
|
29
29
|
def self.search(options = {})
|
30
30
|
predicate = Content.includes([:website_sections])
|
31
31
|
|
32
|
-
|
32
|
+
unless options[:section_unique_name].blank?
|
33
33
|
predicate = predicate.where("website_sections.internal_identifier = ?", options[:section_unique_name])
|
34
34
|
end
|
35
35
|
|
36
|
-
|
36
|
+
unless options[:parent_id].blank?
|
37
37
|
predicate = predicate.where("website_sections.id" => WebsiteSection.find(options[:parent_id]).self_and_descendants.collect(&:id))
|
38
38
|
end
|
39
39
|
|
40
|
-
|
40
|
+
unless options[:content_type].blank?
|
41
41
|
predicate = predicate.where("website_sections.type = ?", options[:content_type])
|
42
42
|
end
|
43
43
|
|
44
|
-
|
44
|
+
unless options[:website_id].blank?
|
45
45
|
predicate = predicate.where("website_sections.website_id = ?", options[:website_id])
|
46
46
|
end
|
47
47
|
|
48
48
|
predicate = predicate.where("(UPPER(contents.title) LIKE UPPER('%#{options[:query]}%')
|
49
49
|
OR UPPER(contents.excerpt_html) LIKE UPPER('%#{options[:query]}%')
|
50
50
|
OR UPPER(contents.body_html) LIKE UPPER('%#{options[:query]}%') )").order("contents.created_at DESC")
|
51
|
+
|
51
52
|
if options[:page]
|
52
53
|
predicate.paginate(:page => options[:page], :per_page => options[:per_page])
|
53
54
|
else
|
data/app/models/website.rb
CHANGED
@@ -12,7 +12,7 @@ class Website < ActiveRecord::Base
|
|
12
12
|
friendly_id :name, :use => [:slugged], :slug_column => :internal_identifier
|
13
13
|
|
14
14
|
def should_generate_new_friendly_id?
|
15
|
-
new_record?
|
15
|
+
new_record? and self.internal_identifier.nil?
|
16
16
|
end
|
17
17
|
|
18
18
|
has_many :published_websites, :dependent => :destroy
|
@@ -301,9 +301,6 @@ class Website < ActiveRecord::Base
|
|
301
301
|
File.open(tmp_dir + 'setup.yml', 'wb+') { |f| f.puts(export_setup.to_yaml) }
|
302
302
|
|
303
303
|
(tmp_dir + "#{name}.zip").tap do |file_name|
|
304
|
-
Rails.logger.info "@@@@@@@@@@@@@@@"
|
305
|
-
Rails.logger.info file_name.inspect
|
306
|
-
Rails.logger.info "@@@@@@@@@@@@@@@"
|
307
304
|
file_name.unlink if file_name.exist?
|
308
305
|
Zip::ZipFile.open(file_name.to_s, Zip::ZipFile::CREATE) do |zip|
|
309
306
|
files.each { |file| zip.add(file[:name], file[:path]) if File.exists?(file[:path]) }
|
@@ -86,13 +86,15 @@ module Widgets
|
|
86
86
|
|
87
87
|
def update_password
|
88
88
|
if @user = User.authenticate(current_user.username, params[:old_password])
|
89
|
+
load_profile_data
|
90
|
+
|
89
91
|
if !params[:new_password].blank? && !params[:password_confirmation].blank? && params[:new_password] == params[:password_confirmation]
|
90
92
|
|
91
93
|
@user.password_confirmation= params[:password_confirmation]
|
92
94
|
|
93
95
|
if @user.change_password!(params[:new_password])
|
94
96
|
@message = "Password Updated"
|
95
|
-
|
97
|
+
|
96
98
|
render :update => {:id => "#{@uuid}_result", :view => :index}
|
97
99
|
else
|
98
100
|
@message = "Error Updating Password"
|
@@ -108,6 +110,7 @@ module Widgets
|
|
108
110
|
render :update => {:id => "#{@uuid}_result", :view => :index}
|
109
111
|
end
|
110
112
|
else
|
113
|
+
load_profile_data
|
111
114
|
#### old password wrong ####
|
112
115
|
@message = "Invalid Old Password"
|
113
116
|
@message_cls = 'sexyerror'
|
data/lib/knitkit/engine.rb
CHANGED
@@ -10,7 +10,7 @@ module Knitkit
|
|
10
10
|
config.knitkit = Knitkit::Config
|
11
11
|
|
12
12
|
initializer "knikit.merge_public" do |app|
|
13
|
-
app.middleware.insert_before Rack::
|
13
|
+
app.middleware.insert_before Rack::Runtime, ::ActionDispatch::Static, "#{root}/public"
|
14
14
|
end
|
15
15
|
|
16
16
|
ActiveSupport.on_load(:active_record) do
|
@@ -45,13 +45,15 @@ module Knitkit
|
|
45
45
|
order(:position).all
|
46
46
|
published_contents = []
|
47
47
|
section_contents.each do |sc|
|
48
|
-
content_version = Content.get_published_version(@active_publication, sc.content)
|
48
|
+
content_version = Content.get_published_version(@active_publication, sc.content) unless @active_publication.nil?
|
49
|
+
content_version = sc.content if @active_publication.nil? or content_version.nil?
|
49
50
|
published_contents << content_version unless content_version.nil?
|
50
51
|
end
|
51
52
|
|
52
53
|
published_contents.each do |content|
|
54
|
+
content_id = content.content.id rescue content.id
|
53
55
|
html << "<div class='knitkit_content'
|
54
|
-
contentid='#{
|
56
|
+
contentid='#{content_id}'
|
55
57
|
lastupdate='#{content.updated_at.strftime("%m/%d/%Y %I:%M%p")}'>
|
56
58
|
#{(content.body_html.nil? ? '' : content.body_html)}</div>"
|
57
59
|
|
data/lib/knitkit/version.rb
CHANGED
@@ -1,234 +1,237 @@
|
|
1
1
|
Compass.ErpApp.Desktop.Applications.Knitkit.addWebsiteNavItemOptions = function (self, items, record) {
|
2
|
-
|
3
|
-
|
4
|
-
|
5
|
-
|
6
|
-
|
7
|
-
|
8
|
-
|
9
|
-
|
10
|
-
|
11
|
-
|
12
|
-
|
13
|
-
|
14
|
-
|
15
|
-
|
16
|
-
|
17
|
-
|
18
|
-
|
19
|
-
|
20
|
-
|
21
|
-
|
22
|
-
|
23
|
-
|
24
|
-
|
25
|
-
|
26
|
-
|
27
|
-
|
28
|
-
|
29
|
-
|
30
|
-
|
31
|
-
|
32
|
-
|
33
|
-
|
34
|
-
|
35
|
-
|
36
|
-
|
37
|
-
|
38
|
-
|
39
|
-
|
40
|
-
|
41
|
-
|
42
|
-
|
43
|
-
|
44
|
-
|
45
|
-
|
46
|
-
|
47
|
-
|
48
|
-
|
49
|
-
|
50
|
-
|
51
|
-
|
52
|
-
|
53
|
-
|
54
|
-
|
55
|
-
|
56
|
-
|
57
|
-
|
58
|
-
|
59
|
-
|
60
|
-
|
61
|
-
|
62
|
-
|
63
|
-
|
64
|
-
|
65
|
-
|
66
|
-
|
67
|
-
|
68
|
-
|
69
|
-
|
70
|
-
|
71
|
-
|
72
|
-
|
73
|
-
|
74
|
-
|
75
|
-
|
76
|
-
|
77
|
-
|
78
|
-
|
79
|
-
|
80
|
-
|
81
|
-
|
82
|
-
|
83
|
-
|
84
|
-
|
85
|
-
|
86
|
-
|
87
|
-
|
88
|
-
|
89
|
-
|
90
|
-
|
91
|
-
|
92
|
-
|
93
|
-
|
94
|
-
|
95
|
-
|
96
|
-
|
97
|
-
|
98
|
-
|
99
|
-
|
100
|
-
|
101
|
-
|
102
|
-
|
103
|
-
|
104
|
-
|
105
|
-
|
106
|
-
|
107
|
-
|
108
|
-
|
109
|
-
|
110
|
-
|
111
|
-
|
112
|
-
|
113
|
-
|
114
|
-
|
115
|
-
|
116
|
-
|
117
|
-
|
118
|
-
|
119
|
-
|
120
|
-
|
121
|
-
|
122
|
-
|
123
|
-
|
124
|
-
|
125
|
-
|
126
|
-
|
127
|
-
|
128
|
-
|
129
|
-
|
130
|
-
|
131
|
-
|
132
|
-
|
133
|
-
|
134
|
-
|
135
|
-
|
136
|
-
|
137
|
-
|
138
|
-
|
139
|
-
|
140
|
-
|
141
|
-
|
142
|
-
|
143
|
-
|
144
|
-
|
145
|
-
|
146
|
-
|
147
|
-
|
148
|
-
|
149
|
-
|
150
|
-
|
151
|
-
|
152
|
-
|
153
|
-
|
154
|
-
|
155
|
-
|
156
|
-
|
157
|
-
|
158
|
-
|
159
|
-
|
160
|
-
|
161
|
-
|
162
|
-
|
163
|
-
|
164
|
-
|
165
|
-
|
166
|
-
|
167
|
-
|
168
|
-
|
169
|
-
|
170
|
-
|
171
|
-
|
172
|
-
|
173
|
-
|
174
|
-
|
175
|
-
|
176
|
-
|
177
|
-
|
178
|
-
|
179
|
-
|
180
|
-
|
181
|
-
|
182
|
-
|
183
|
-
|
184
|
-
|
185
|
-
|
186
|
-
|
187
|
-
|
188
|
-
|
189
|
-
|
190
|
-
|
191
|
-
|
192
|
-
|
193
|
-
|
194
|
-
|
195
|
-
|
196
|
-
|
197
|
-
|
198
|
-
|
199
|
-
|
200
|
-
|
201
|
-
|
202
|
-
|
203
|
-
|
204
|
-
|
205
|
-
|
206
|
-
|
207
|
-
|
208
|
-
|
209
|
-
|
210
|
-
|
211
|
-
|
212
|
-
|
213
|
-
|
214
|
-
|
215
|
-
|
216
|
-
|
217
|
-
|
218
|
-
|
219
|
-
|
220
|
-
|
221
|
-
|
222
|
-
|
223
|
-
|
224
|
-
|
225
|
-
|
226
|
-
|
227
|
-
|
228
|
-
|
229
|
-
|
230
|
-
|
231
|
-
|
232
|
-
|
233
|
-
|
2
|
+
if (currentUser.hasCapability('edit', 'WebsiteNavItem')) {
|
3
|
+
items.push({
|
4
|
+
text: 'Update Menu Item',
|
5
|
+
iconCls: 'icon-edit',
|
6
|
+
handler: function (btn) {
|
7
|
+
var addMenuItemWindow = Ext.create("Ext.window.Window", {
|
8
|
+
layout: 'fit',
|
9
|
+
width: 375,
|
10
|
+
title: 'Update Menu Item',
|
11
|
+
height: 175,
|
12
|
+
plain: true,
|
13
|
+
buttonAlign: 'center',
|
14
|
+
items: Ext.create('Ext.form.Panel', {
|
15
|
+
labelWidth: 50,
|
16
|
+
frame: false,
|
17
|
+
bodyStyle: 'padding:5px 5px 0',
|
18
|
+
url: '/knitkit/erp_app/desktop/website_nav/update_menu_item',
|
19
|
+
defaults: {
|
20
|
+
width: 225
|
21
|
+
},
|
22
|
+
items: [
|
23
|
+
{
|
24
|
+
xtype: 'textfield',
|
25
|
+
fieldLabel: 'Title',
|
26
|
+
value: record.data.text,
|
27
|
+
allowBlank: false,
|
28
|
+
name: 'title'
|
29
|
+
},
|
30
|
+
{
|
31
|
+
xtype: 'combo',
|
32
|
+
fieldLabel: 'Link to',
|
33
|
+
name: 'link_to',
|
34
|
+
id: 'knitkit_nav_item_link_to',
|
35
|
+
allowBlank: false,
|
36
|
+
forceSelection: true,
|
37
|
+
editable: false,
|
38
|
+
autoSelect: true,
|
39
|
+
typeAhead: false,
|
40
|
+
mode: 'local',
|
41
|
+
triggerAction: 'all',
|
42
|
+
store: [
|
43
|
+
['website_section', 'Section'],
|
44
|
+
//['article','Article'],
|
45
|
+
['url', 'Url']
|
46
|
+
|
47
|
+
],
|
48
|
+
value: record.data.linkToType,
|
49
|
+
listeners: {
|
50
|
+
'change': function (combo, newValue, oldValue) {
|
51
|
+
switch (newValue) {
|
52
|
+
case 'website_section':
|
53
|
+
Ext.getCmp('knitkit_website_nav_item_section').show();
|
54
|
+
//Ext.getCmp('knitkit_website_nav_item_article').hide();
|
55
|
+
Ext.getCmp('knitkit_website_nav_item_url').hide();
|
56
|
+
break;
|
57
|
+
case 'article':
|
58
|
+
Ext.getCmp('knitkit_website_nav_item_section').hide();
|
59
|
+
//Ext.getCmp('knitkit_website_nav_item_article').show();
|
60
|
+
Ext.getCmp('knitkit_website_nav_item_url').hide();
|
61
|
+
break;
|
62
|
+
case 'url':
|
63
|
+
Ext.getCmp('knitkit_website_nav_item_section').hide();
|
64
|
+
//Ext.getCmp('knitkit_website_nav_item_article').hide();
|
65
|
+
Ext.getCmp('knitkit_website_nav_item_url').show();
|
66
|
+
break;
|
67
|
+
}
|
68
|
+
}
|
69
|
+
}
|
70
|
+
},
|
71
|
+
{
|
72
|
+
xtype: 'combo',
|
73
|
+
width: 300,
|
74
|
+
itemId: 'knitkit_website_nav_item_section',
|
75
|
+
hiddenName: 'website_section_id',
|
76
|
+
name: 'website_section_id',
|
77
|
+
loadingText: 'Retrieving Sections...',
|
78
|
+
store: Ext.create("Ext.data.Store", {
|
79
|
+
proxy: {
|
80
|
+
type: 'ajax',
|
81
|
+
url: '/knitkit/erp_app/desktop/section/existing_sections',
|
82
|
+
reader: {
|
83
|
+
type: 'json'
|
84
|
+
},
|
85
|
+
extraParams: {
|
86
|
+
website_id: record.data.websiteId
|
87
|
+
}
|
88
|
+
},
|
89
|
+
fields: [
|
90
|
+
{
|
91
|
+
name: 'id',
|
92
|
+
type: 'integer'
|
93
|
+
},
|
94
|
+
{
|
95
|
+
name: 'title_permalink',
|
96
|
+
type: 'string'
|
97
|
+
}
|
98
|
+
]
|
99
|
+
}),
|
100
|
+
//forceSelection: true,
|
101
|
+
editable: false,
|
102
|
+
fieldLabel: 'Section',
|
103
|
+
//autoSelect: true,
|
104
|
+
typeAhead: false,
|
105
|
+
queryMode: 'local',
|
106
|
+
displayField: 'title_permalink',
|
107
|
+
valueField: 'id',
|
108
|
+
hidden: (record.data.linkToType != 'website_section' && record.data.linkToType != 'article')
|
109
|
+
},
|
110
|
+
{
|
111
|
+
xtype: 'textfield',
|
112
|
+
fieldLabel: 'Url',
|
113
|
+
value: record.data.url,
|
114
|
+
id: 'knitkit_website_nav_item_url',
|
115
|
+
hidden: (record.data.linkToType == 'website_section' || record.data.linkToType == 'article'),
|
116
|
+
name: 'url'
|
117
|
+
},
|
118
|
+
{
|
119
|
+
xtype: 'hidden',
|
120
|
+
name: 'website_nav_item_id',
|
121
|
+
value: record.data.websiteNavItemId
|
122
|
+
}
|
123
|
+
]
|
124
|
+
}),
|
125
|
+
buttons: [
|
126
|
+
{
|
127
|
+
text: 'Submit',
|
128
|
+
listeners: {
|
129
|
+
'click': function (button) {
|
130
|
+
var window = button.findParentByType('window'),
|
131
|
+
formPanel = window.query('form')[0];
|
132
|
+
self.setWindowStatus('Updating menu item...');
|
133
|
+
formPanel.getForm().submit({
|
134
|
+
reset: false,
|
135
|
+
success: function (form, action) {
|
136
|
+
self.clearWindowStatus();
|
137
|
+
var obj = Ext.decode(action.response.responseText);
|
138
|
+
if (obj.success) {
|
139
|
+
record.set('linkedToId', parseInt(obj.linkedToId));
|
140
|
+
record.set('linkToType', obj.linkToType);
|
141
|
+
record.set('url', obj.url);
|
142
|
+
record.set('text', obj.title);
|
143
|
+
record.commit();
|
144
|
+
window.close();
|
145
|
+
}
|
146
|
+
else {
|
147
|
+
Ext.Msg.alert("Error", obj.msg);
|
148
|
+
}
|
149
|
+
},
|
150
|
+
failure: function (form, action) {
|
151
|
+
self.clearWindowStatus();
|
152
|
+
if (action.response === null) {
|
153
|
+
Ext.Msg.alert("Error", 'Could not create menu item');
|
154
|
+
}
|
155
|
+
else {
|
156
|
+
var obj = Ext.decode(action.response.responseText);
|
157
|
+
Ext.Msg.alert("Error", obj.msg);
|
158
|
+
}
|
159
|
+
}
|
160
|
+
});
|
161
|
+
}
|
162
|
+
}
|
163
|
+
},
|
164
|
+
{
|
165
|
+
text: 'Close',
|
166
|
+
handler: function () {
|
167
|
+
addMenuItemWindow.close();
|
168
|
+
}
|
169
|
+
}
|
170
|
+
],
|
171
|
+
listeners: {
|
172
|
+
show: function () {
|
173
|
+
var select = this.down('#knitkit_website_nav_item_section');
|
174
|
+
select.getStore().load({
|
175
|
+
callback: function () {
|
176
|
+
select.setValue(record.get('linkedToId'));
|
177
|
+
}
|
178
|
+
});
|
179
|
+
}
|
180
|
+
}
|
181
|
+
}).show();
|
182
|
+
}
|
183
|
+
});
|
184
|
+
}
|
185
|
+
|
186
|
+
if (currentUser.hasCapability('unsecure', 'WebsiteNavItem') || currentUser.hasCapability('secure', 'WebsiteNavItem')) {
|
187
|
+
items.push({
|
188
|
+
text: 'Security',
|
189
|
+
iconCls: 'icon-document_lock',
|
190
|
+
listeners: {
|
191
|
+
'click': function () {
|
192
|
+
self.changeSecurity(record, '/knitkit/erp_app/desktop/website_nav/update_security', record.data.websiteNavItemId);
|
193
|
+
}
|
194
|
+
}
|
195
|
+
});
|
196
|
+
}
|
197
|
+
|
198
|
+
if (currentUser.hasCapability('delete', 'WebsiteNavItem')) {
|
199
|
+
items.push({
|
200
|
+
text: 'Delete',
|
201
|
+
iconCls: 'icon-delete',
|
202
|
+
handler: function (btn) {
|
203
|
+
Ext.MessageBox.confirm('Confirm', 'Are you sure you want to delete this menu item?', function (btn) {
|
204
|
+
if (btn == 'no') {
|
205
|
+
return false;
|
206
|
+
}
|
207
|
+
else if (btn == 'yes') {
|
208
|
+
self.setWindowStatus('Deleting menu item...');
|
209
|
+
Ext.Ajax.request({
|
210
|
+
url: '/knitkit/erp_app/desktop/website_nav/delete_menu_item',
|
211
|
+
method: 'POST',
|
212
|
+
params: {
|
213
|
+
id: record.data.websiteNavItemId
|
214
|
+
},
|
215
|
+
success: function (response) {
|
216
|
+
self.clearWindowStatus();
|
217
|
+
var obj = Ext.decode(response.responseText);
|
218
|
+
if (obj.success) {
|
219
|
+
record.remove(true);
|
220
|
+
}
|
221
|
+
else {
|
222
|
+
Ext.Msg.alert('Error', 'Error deleting menu item');
|
223
|
+
}
|
224
|
+
},
|
225
|
+
failure: function (response) {
|
226
|
+
self.clearWindowStatus();
|
227
|
+
Ext.Msg.alert('Error', 'Error deleting menu item');
|
228
|
+
}
|
229
|
+
});
|
230
|
+
}
|
231
|
+
});
|
232
|
+
}
|
233
|
+
});
|
234
|
+
}
|
235
|
+
|
236
|
+
return items;
|
234
237
|
};
|
@@ -12,7 +12,7 @@ Ext.define("Compass.ErpApp.Desktop.Applications.Knitkit.WestRegion", {
|
|
12
12
|
|
13
13
|
deleteSection:function (node) {
|
14
14
|
var self = this;
|
15
|
-
Ext.MessageBox.confirm('Confirm', 'Are you sure you want to delete this section?<br> NOTE: Articles belonging to this section will be orphaned
|
15
|
+
Ext.MessageBox.confirm('Confirm', 'Are you sure you want to delete this section?<br> NOTE: Articles belonging to this section will be orphaned.<br><br>', function (btn) {
|
16
16
|
if (btn == 'no') {
|
17
17
|
return false;
|
18
18
|
}
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: knitkit
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 2.1.
|
4
|
+
version: 2.1.13
|
5
5
|
prerelease:
|
6
6
|
platform: ruby
|
7
7
|
authors:
|
@@ -9,7 +9,7 @@ authors:
|
|
9
9
|
autorequire:
|
10
10
|
bindir: bin
|
11
11
|
cert_chain: []
|
12
|
-
date: 2013-08-
|
12
|
+
date: 2013-08-14 00:00:00.000000000 Z
|
13
13
|
dependencies:
|
14
14
|
- !ruby/object:Gem::Dependency
|
15
15
|
name: erp_forms
|