knitkit 2.1.2 → 2.1.3
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- data/app/controllers/knitkit/comments_controller.rb +1 -1
- data/app/controllers/knitkit/erp_app/desktop/app_controller.rb +5 -0
- data/app/controllers/knitkit/erp_app/desktop/articles_controller.rb +0 -4
- data/app/controllers/knitkit/erp_app/desktop/content_controller.rb +0 -2
- data/app/controllers/knitkit/erp_app/desktop/theme_controller.rb +13 -0
- data/app/controllers/knitkit/erp_app/desktop/website_section_controller.rb +37 -29
- data/app/controllers/knitkit/online_document_sections_controller.rb +1 -1
- data/app/models/website_section.rb +2 -3
- data/app/views/knitkit/blogs/_add_comment.html.erb +2 -1
- data/app/views/knitkit/online_document_sections/index.html.erb +143 -136
- data/app/views/layouts/knitkit/online_document_sections.html.erb +2 -2
- data/app/widgets/contact_us/javascript/contact_us.js +3 -1
- data/app/widgets/dynamic_forms/javascript/dynamic_forms.js +91 -92
- data/app/widgets/dynamic_grid/base.rb +7 -7
- data/app/widgets/dynamic_grid/javascript/dynamic_grid.js +111 -112
- data/app/widgets/dynamic_grid/views/index.html.erb +1 -1
- data/app/widgets/google_map/javascript/google_map.js +132 -119
- data/app/widgets/google_map/views/index.html.erb +1 -1
- data/app/widgets/login/javascript/login.js +160 -155
- data/app/widgets/manage_profile/javascript/manage_profile.js +3 -1
- data/app/widgets/reset_password/javascript/reset_password.js +3 -1
- data/app/widgets/scaffold/base.rb +8 -4
- data/app/widgets/scaffold/javascript/scaffold.js +218 -220
- data/app/widgets/scaffold/views/index.html.erb +1 -1
- data/app/widgets/search/javascript/search.js +21 -21
- data/app/widgets/signup/javascript/signup.js +2 -1
- data/config/routes.rb +1 -1
- data/lib/knitkit/extensions/railties/action_view/helpers/blog_helper.rb +3 -3
- data/lib/knitkit/extensions/railties/action_view/helpers/knitkit_helper.rb +0 -2
- data/lib/knitkit/version.rb +1 -1
- data/public/javascripts/erp_app/desktop/applications/knitkit/center_region.js +6 -7
- data/public/javascripts/erp_app/desktop/applications/knitkit/publish_window.js +3 -3
- data/public/javascripts/erp_app/desktop/applications/knitkit/select_roles_window.js +103 -0
- data/public/javascripts/erp_app/desktop/applications/knitkit/west_region/helpers/section.js +4 -4
- data/public/javascripts/erp_app/desktop/applications/knitkit/west_region/west_region.js +32 -21
- metadata +3 -2
@@ -7,7 +7,7 @@ module Knitkit
|
|
7
7
|
|
8
8
|
@comment = content.add_comment({:commentor_name => user.party.description, :email => user.email, :comment => comment})
|
9
9
|
|
10
|
-
render :text => (@comment.valid? ? '<div class="
|
10
|
+
render :text => (@comment.valid? ? '<div class="sexynotice">Comment pending approval.</div>' : '<div class="sexynotice">Error. Comment cannot be blank.</div>')
|
11
11
|
end
|
12
12
|
|
13
13
|
#no section to set
|
@@ -4,6 +4,10 @@ module Knitkit
|
|
4
4
|
class AppController < ::ErpApp::Desktop::BaseController
|
5
5
|
KNIT_KIT_ROOT = Knitkit::Engine.root.to_s
|
6
6
|
|
7
|
+
def available_roles
|
8
|
+
render :json => {:success => true, :availableRoles => SecurityRole.all.collect{|role| role.to_hash(:only => [:internal_identifier, :description])}}
|
9
|
+
end
|
10
|
+
|
7
11
|
def websites
|
8
12
|
websites = Website.order('name ASC').all
|
9
13
|
|
@@ -107,6 +111,7 @@ module Knitkit
|
|
107
111
|
:siteId => website.id,
|
108
112
|
:type => website_section.type,
|
109
113
|
:isSecured => website_section.is_secured?,
|
114
|
+
:roles => website_section.roles.collect{|item| item.internal_identifier},
|
110
115
|
:isSection => website_section.is_section?,
|
111
116
|
:isDocument => website_section.is_document_section?,
|
112
117
|
:inMenu => website_section.in_menu,
|
@@ -5,7 +5,6 @@ module Knitkit
|
|
5
5
|
@@datetime_format = "%m/%d/%Y %l:%M%P"
|
6
6
|
|
7
7
|
def new
|
8
|
-
model = DesktopApplication.find_by_internal_identifier('knitkit')
|
9
8
|
begin
|
10
9
|
current_user.with_capability('create', 'Content') do
|
11
10
|
result = {}
|
@@ -38,7 +37,6 @@ module Knitkit
|
|
38
37
|
end
|
39
38
|
|
40
39
|
def update
|
41
|
-
model = DesktopApplication.find_by_internal_identifier('knitkit')
|
42
40
|
begin
|
43
41
|
current_user.with_capability('edit', 'Content') do
|
44
42
|
result = {}
|
@@ -70,7 +68,6 @@ module Knitkit
|
|
70
68
|
end
|
71
69
|
|
72
70
|
def delete
|
73
|
-
model = DesktopApplication.find_by_internal_identifier('knitkit')
|
74
71
|
begin
|
75
72
|
current_user.with_capability('delete', 'Content') do
|
76
73
|
render :json => Article.destroy(params[:id]) ? {:success => true} : {:success => false}
|
@@ -81,7 +78,6 @@ module Knitkit
|
|
81
78
|
end
|
82
79
|
|
83
80
|
def add_existing
|
84
|
-
model = DesktopApplication.find_by_internal_identifier('knitkit')
|
85
81
|
begin
|
86
82
|
current_user.with_capability('add_existing', 'Content') do
|
87
83
|
website_section = WebsiteSection.find(params[:section_id])
|
@@ -5,7 +5,6 @@ module Knitkit
|
|
5
5
|
class ContentController < Knitkit::ErpApp::Desktop::AppController
|
6
6
|
def update
|
7
7
|
result = {:success => true}
|
8
|
-
model = DesktopApplication.find_by_internal_identifier('knitkit')
|
9
8
|
begin
|
10
9
|
current_user.with_capability('edit_html', 'Content') do
|
11
10
|
id = params[:id]
|
@@ -33,7 +32,6 @@ module Knitkit
|
|
33
32
|
|
34
33
|
def save_excerpt
|
35
34
|
result = {:success => true}
|
36
|
-
model = DesktopApplication.find_by_internal_identifier('knitkit')
|
37
35
|
begin
|
38
36
|
current_user.with_capability('edit_excerpt', 'Content') do
|
39
37
|
id = params[:id]
|
@@ -274,6 +274,19 @@ module Knitkit
|
|
274
274
|
end
|
275
275
|
end
|
276
276
|
|
277
|
+
def get_ckeditor_selectable_themes
|
278
|
+
themes = []
|
279
|
+
Theme.where('active = ?', 1).all.each do |theme|
|
280
|
+
theme_hash = {:name => theme.name, :theme_id => theme.theme_id, :stylesheets => []}
|
281
|
+
theme.stylesheets.each do |stylesheet|
|
282
|
+
theme_hash[:stylesheets] << {:name => stylesheet.name, :url => stylesheet.data.url}
|
283
|
+
end
|
284
|
+
themes << theme_hash
|
285
|
+
end
|
286
|
+
|
287
|
+
render :json => {:success => true, :themes => themes}
|
288
|
+
end
|
289
|
+
|
277
290
|
protected
|
278
291
|
|
279
292
|
def get_theme(path)
|
@@ -27,12 +27,12 @@ module Knitkit
|
|
27
27
|
parent_website_section = WebsiteSection.find(params[:website_section_id])
|
28
28
|
website_section.move_to_child_of(parent_website_section)
|
29
29
|
end
|
30
|
-
|
30
|
+
|
31
31
|
if params[:type] == "OnlineDocumentSection"
|
32
32
|
documented_content = DocumentedContent.create(:title => website_section.title, :created_by => current_user, :body_html => website_section.title)
|
33
33
|
DocumentedItem.create(:documented_content_id => documented_content.id, :online_document_section_id => website_section.id)
|
34
34
|
end
|
35
|
-
|
35
|
+
|
36
36
|
website_section.update_path!
|
37
37
|
result = {:success => true, :node => build_section_hash(website_section, website_section.website)}
|
38
38
|
else
|
@@ -48,7 +48,7 @@ module Knitkit
|
|
48
48
|
|
49
49
|
render :json => result
|
50
50
|
end
|
51
|
-
rescue ErpTechSvcs::Utils::CompassAccessNegotiator::Errors::UserDoesNotHaveCapability=>ex
|
51
|
+
rescue ErpTechSvcs::Utils::CompassAccessNegotiator::Errors::UserDoesNotHaveCapability => ex
|
52
52
|
render :json => {:success => false, :message => ex.message}
|
53
53
|
end
|
54
54
|
end
|
@@ -58,7 +58,7 @@ module Knitkit
|
|
58
58
|
current_user.with_capability('delete', 'WebsiteSection') do
|
59
59
|
render :json => WebsiteSection.destroy(params[:id]) ? {:success => true} : {:success => false}
|
60
60
|
end
|
61
|
-
rescue ErpTechSvcs::Utils::CompassAccessNegotiator::Errors::UserDoesNotHaveCapability=>ex
|
61
|
+
rescue ErpTechSvcs::Utils::CompassAccessNegotiator::Errors::UserDoesNotHaveCapability => ex
|
62
62
|
render :json => {:success => false, :message => ex.message}
|
63
63
|
end
|
64
64
|
end
|
@@ -70,19 +70,27 @@ module Knitkit
|
|
70
70
|
|
71
71
|
def update_security
|
72
72
|
if current_user.has_capability?('secure', 'WebsiteSection') or current_user.has_capability?('unsecure', 'WebsiteSection')
|
73
|
+
roles = []
|
74
|
+
|
75
|
+
#get roles
|
76
|
+
params.each do |k, v|
|
77
|
+
if v == 'on'
|
78
|
+
roles.push(k)
|
79
|
+
end
|
80
|
+
end
|
73
81
|
|
74
|
-
if
|
75
|
-
|
76
|
-
|
82
|
+
if roles.empty?
|
83
|
+
@website_section.remove_capability(:view)
|
84
|
+
else
|
85
|
+
capability = @website_section.add_capability(:view)
|
86
|
+
capability.remove_all_roles
|
77
87
|
roles.each do |r|
|
78
88
|
role = SecurityRole.find_by_internal_identifier(r)
|
79
|
-
role.add_capability(
|
89
|
+
role.add_capability(capability)
|
80
90
|
end
|
81
|
-
else
|
82
|
-
@website_section.remove_capability(:view)
|
83
91
|
end
|
84
92
|
|
85
|
-
render :json => {:success => true}
|
93
|
+
render :json => {:success => true, :secured => @website_section.is_secured?, :roles => @website_section.roles.collect{|item| item.internal_identifier}}
|
86
94
|
else
|
87
95
|
render :json => {:success => false, :message => "User does not have capability."}
|
88
96
|
end
|
@@ -105,7 +113,7 @@ module Knitkit
|
|
105
113
|
render :json => {:success => false}
|
106
114
|
end
|
107
115
|
end
|
108
|
-
rescue ErpTechSvcs::Utils::CompassAccessNegotiator::Errors::UserDoesNotHaveCapability=>ex
|
116
|
+
rescue ErpTechSvcs::Utils::CompassAccessNegotiator::Errors::UserDoesNotHaveCapability => ex
|
109
117
|
render :json => {:success => false, :message => ex.message}
|
110
118
|
end
|
111
119
|
end
|
@@ -116,7 +124,7 @@ module Knitkit
|
|
116
124
|
@website_section.create_layout
|
117
125
|
render :json => {:success => true}
|
118
126
|
end
|
119
|
-
rescue ErpTechSvcs::Utils::CompassAccessNegotiator::Errors::UserDoesNotHaveCapability=>ex
|
127
|
+
rescue ErpTechSvcs::Utils::CompassAccessNegotiator::Errors::UserDoesNotHaveCapability => ex
|
120
128
|
render :json => {:success => false, :message => ex.message}
|
121
129
|
end
|
122
130
|
end
|
@@ -126,15 +134,15 @@ module Knitkit
|
|
126
134
|
current_user.with_capability('edit', 'WebsiteSectionLayout') do
|
127
135
|
render :text => @website_section.layout
|
128
136
|
end
|
129
|
-
rescue ErpTechSvcs::Utils::CompassAccessNegotiator::Errors::UserDoesNotHaveCapability=>ex
|
137
|
+
rescue ErpTechSvcs::Utils::CompassAccessNegotiator::Errors::UserDoesNotHaveCapability => ex
|
130
138
|
render :json => {:success => false, :message => ex.message}
|
131
139
|
end
|
132
140
|
end
|
133
|
-
|
141
|
+
|
134
142
|
def save_layout
|
135
143
|
begin
|
136
144
|
current_user.with_capability('edit', 'WebsiteSectionLayout') do
|
137
|
-
|
145
|
+
result = Knitkit::SyntaxValidator.validate_content(:erb, params[:content])
|
138
146
|
unless result
|
139
147
|
website = @website_section.website
|
140
148
|
@website_section.layout = params[:content]
|
@@ -145,7 +153,7 @@ module Knitkit
|
|
145
153
|
render :json => {:success => false, :message => result}
|
146
154
|
end
|
147
155
|
end
|
148
|
-
rescue ErpTechSvcs::Utils::CompassAccessNegotiator::Errors::UserDoesNotHaveCapability=>ex
|
156
|
+
rescue ErpTechSvcs::Utils::CompassAccessNegotiator::Errors::UserDoesNotHaveCapability => ex
|
149
157
|
render :json => {:success => false, :message => ex.message}
|
150
158
|
end
|
151
159
|
end
|
@@ -155,10 +163,10 @@ module Knitkit
|
|
155
163
|
websites = Website.all
|
156
164
|
all_articles = [{:name => 'All Articles', :id => 0}]
|
157
165
|
orphaned_articles = [{:name => 'Orphaned Articles Only', :id => -1}]
|
158
|
-
|
166
|
+
|
159
167
|
websites_array = []
|
160
|
-
websites.each do |w|
|
161
|
-
websites_array << {
|
168
|
+
websites.each do |w|
|
169
|
+
websites_array << {:name => "Website: #{w.name}", :id => w.id}
|
162
170
|
end
|
163
171
|
|
164
172
|
menu = all_articles + orphaned_articles + websites_array
|
@@ -175,7 +183,7 @@ module Knitkit
|
|
175
183
|
|
176
184
|
# Orphaned Articles
|
177
185
|
if !website_id.blank? and website_id.to_i == -1
|
178
|
-
available_articles = available_articles.includes(:website_section_contents).where(
|
186
|
+
available_articles = available_articles.includes(:website_section_contents).where(:website_section_contents => {:content_id => nil})
|
179
187
|
end
|
180
188
|
|
181
189
|
# Website Articles
|
@@ -187,7 +195,7 @@ module Knitkit
|
|
187
195
|
|
188
196
|
render :inline => "{\"articles\":#{available_articles.to_json(:only => [:title, :internal_identifier, :id], :methods => [:combobox_display_value])}}"
|
189
197
|
end
|
190
|
-
|
198
|
+
|
191
199
|
def existing_sections
|
192
200
|
website = Website.find(params[:website_id])
|
193
201
|
WebsiteSection.class_eval do
|
@@ -197,14 +205,14 @@ module Knitkit
|
|
197
205
|
end
|
198
206
|
render :inline => website.sections.to_json(:only => [:id], :methods => [:title_permalink])
|
199
207
|
end
|
200
|
-
|
208
|
+
|
201
209
|
protected
|
202
|
-
|
210
|
+
|
203
211
|
def set_website_section
|
204
212
|
@website_section = WebsiteSection.find(params[:id])
|
205
213
|
end
|
206
|
-
|
207
|
-
end#WebsiteSectionController
|
208
|
-
end#Desktop
|
209
|
-
end#ErpApp
|
210
|
-
end#Knitkit
|
214
|
+
|
215
|
+
end #WebsiteSectionController
|
216
|
+
end #Desktop
|
217
|
+
end #ErpApp
|
218
|
+
end #Knitkit
|
@@ -22,7 +22,7 @@ module Knitkit
|
|
22
22
|
def find_root
|
23
23
|
@root = OnlineDocumentSection.find(params[:section_id])
|
24
24
|
if @root.documented_item_published_content(@active_publication)
|
25
|
-
@root_content = @root.documented_item_published_content(@active_publication).body_html
|
25
|
+
@root_content = @root.documented_item_published_content(@active_publication).body_html.gsub(/\n/, '<br/>')
|
26
26
|
else
|
27
27
|
@root_content = ""
|
28
28
|
end
|
@@ -2,7 +2,7 @@ class WebsiteSection < ActiveRecord::Base
|
|
2
2
|
attr_protected :created_at, :updated_at
|
3
3
|
|
4
4
|
after_create :update_paths # must happen after has_roles so that after_create :save_secured_model fires first
|
5
|
-
before_save :update_path, :
|
5
|
+
before_save :update_path, :check_internal_identifier
|
6
6
|
|
7
7
|
extend FriendlyId
|
8
8
|
friendly_id :title, :use => [:slugged, :scoped], :slug_column => :permalink, :scope => [:website_id, :parent_id]
|
@@ -98,7 +98,6 @@ class WebsiteSection < ActiveRecord::Base
|
|
98
98
|
end
|
99
99
|
|
100
100
|
def get_published_layout(active_publication)
|
101
|
-
layout_content = nil
|
102
101
|
published_website_id = active_publication.id
|
103
102
|
published_element = PublishedElement.includes([:published_website]).where('published_websites.id = ? and published_element_record_id = ? and published_element_record_type = ?', published_website_id, self.id, 'WebsiteSection').first
|
104
103
|
unless published_element.nil?
|
@@ -188,7 +187,7 @@ class WebsiteSection < ActiveRecord::Base
|
|
188
187
|
end
|
189
188
|
end
|
190
189
|
|
191
|
-
def
|
190
|
+
def check_internal_identifier
|
192
191
|
self.internal_identifier = self.permalink if self.internal_identifier.blank?
|
193
192
|
end
|
194
193
|
|
@@ -4,7 +4,7 @@
|
|
4
4
|
<div id="notice"></div>
|
5
5
|
<br/>
|
6
6
|
|
7
|
-
<%= form_tag "/comments/add
|
7
|
+
<%= form_tag "/comments/add/", :remote => true, :id => 'add_comment_form' do %>
|
8
8
|
<div class="form_settings">
|
9
9
|
<div>
|
10
10
|
<p>
|
@@ -15,6 +15,7 @@
|
|
15
15
|
<span> </span>
|
16
16
|
<%= submit_tag "Add Comment", :disable_with => "Please wait...", :class => "submit" %>
|
17
17
|
</p>
|
18
|
+
<input type="hidden" name="content_id" value="<%=@published_content.content.id%>" />
|
18
19
|
</div>
|
19
20
|
</div>
|
20
21
|
<% end %>
|
@@ -3,147 +3,154 @@
|
|
3
3
|
|
4
4
|
<script type="text/javascript" charset="utf-8">
|
5
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
|
-
valueField: 'id',
|
46
|
-
title: '<%= @root.title %>',
|
47
|
-
listeners:{
|
48
|
-
'itemclick':function(view, record, htmlItem, index, e){
|
49
|
-
var tab_panel = Ext.getCmp('tabs_root')
|
50
|
-
var tab = Ext.getCmp("tab_" + record.data['id'])
|
51
|
-
if (tab){
|
52
|
-
tab_panel.setActiveTab(tab.id);
|
53
|
-
}
|
54
|
-
else{
|
55
|
-
addTab(record);
|
56
|
-
}
|
57
|
-
}
|
58
|
-
}
|
59
|
-
});
|
60
|
-
|
61
|
-
var tabs = Ext.createWidget('tabpanel', {
|
62
|
-
id: 'tabs_root',
|
63
|
-
region: 'center',
|
64
|
-
plain: true,
|
65
|
-
bodyBorder: true,
|
66
|
-
resizeTabs: true,
|
67
|
-
enableTabScroll: true,
|
68
|
-
width: 640,
|
69
|
-
collapsible: false,
|
70
|
-
defaults: {
|
6
|
+
Ext.onReady(function () {
|
7
|
+
var index = 0;
|
8
|
+
var currentItem;
|
9
|
+
|
10
|
+
var tree = Ext.create('Ext.tree.Panel', {
|
11
|
+
region: 'west',
|
12
|
+
cls: 'tree_styles',
|
13
|
+
store: Ext.create('Ext.data.TreeStore',{
|
14
|
+
proxy: {
|
15
|
+
type: 'ajax',
|
16
|
+
url: 'online_document_sections/build_tree',
|
17
|
+
extraParams: { section_id: <%= params[:section_id] %> },
|
18
|
+
format: 'json'
|
19
|
+
},
|
20
|
+
root: {
|
21
|
+
text: '<%= @root.title %>',
|
22
|
+
id: '0',
|
23
|
+
expanded: true
|
24
|
+
},
|
25
|
+
fields: [
|
26
|
+
{ name: 'id' },
|
27
|
+
{ name: 'title' },
|
28
|
+
{ name: 'documented_item_published_content_html' },
|
29
|
+
{ name: 'leaf' }
|
30
|
+
]
|
31
|
+
}),
|
32
|
+
collapsible: true,
|
33
|
+
tbar: {
|
34
|
+
items: [
|
35
|
+
new Ext.form.TextField({
|
36
|
+
id: "search",
|
37
|
+
disabled: true,
|
38
|
+
cls: 'document_search',
|
39
|
+
emptyText: 'Search',
|
40
|
+
allowBlank: true,
|
41
|
+
})
|
42
|
+
]
|
43
|
+
},
|
44
|
+
header: false,
|
71
45
|
autoScroll: true,
|
72
|
-
|
73
|
-
|
74
|
-
|
75
|
-
|
46
|
+
bodyBorder: false,
|
47
|
+
rootVisible: false,
|
48
|
+
width: 170,
|
49
|
+
displayField: 'title',
|
50
|
+
valueField: 'id',
|
76
51
|
title: '<%= @root.title %>',
|
77
|
-
|
78
|
-
|
79
|
-
|
80
|
-
|
81
|
-
|
82
|
-
|
83
|
-
'-',
|
84
|
-
{
|
85
|
-
text: 'Closable',
|
86
|
-
checked: true,
|
87
|
-
hideOnClick: true,
|
88
|
-
handler: function (item) {
|
89
|
-
currentItem.tab.setClosable(item.checked);
|
52
|
+
listeners: {
|
53
|
+
'itemclick': function (view, record, htmlItem, index, e) {
|
54
|
+
var tab_panel = Ext.getCmp('tabs_root')
|
55
|
+
var tab = Ext.getCmp("tab_" + record.data['id'])
|
56
|
+
if (tab) {
|
57
|
+
tab_panel.setActiveTab(tab.id);
|
90
58
|
}
|
59
|
+
else {
|
60
|
+
addTab(record);
|
61
|
+
}
|
62
|
+
}
|
63
|
+
}
|
64
|
+
});
|
65
|
+
|
66
|
+
var tabs = Ext.createWidget('tabpanel', {
|
67
|
+
id: 'tabs_root',
|
68
|
+
region: 'center',
|
69
|
+
plain: true,
|
70
|
+
bodyBorder: true,
|
71
|
+
resizeTabs: true,
|
72
|
+
enableTabScroll: true,
|
73
|
+
width: 640,
|
74
|
+
collapsible: false,
|
75
|
+
defaults: {
|
76
|
+
autoScroll: true,
|
77
|
+
bodyPadding: 10,
|
78
|
+
},
|
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
|
91
86
|
}
|
92
87
|
],
|
93
|
-
|
94
|
-
|
95
|
-
|
96
|
-
|
97
|
-
|
98
|
-
|
99
|
-
|
100
|
-
|
88
|
+
plugins: Ext.create('Ext.ux.TabCloseMenu', {
|
89
|
+
extraItemsTail: [
|
90
|
+
'-',
|
91
|
+
{
|
92
|
+
text: 'Closable',
|
93
|
+
checked: true,
|
94
|
+
hideOnClick: true,
|
95
|
+
handler: function (item) {
|
96
|
+
currentItem.tab.setClosable(item.checked);
|
97
|
+
}
|
98
|
+
}
|
99
|
+
],
|
100
|
+
listeners: {
|
101
|
+
aftermenu: function () {
|
102
|
+
currentItem = null;
|
103
|
+
},
|
104
|
+
beforemenu: function (menu, item) {
|
105
|
+
var menuitem = menu.child('*[text="Closable"]');
|
106
|
+
currentItem = item;
|
107
|
+
menuitem.setChecked(item.closable);
|
108
|
+
}
|
101
109
|
}
|
102
|
-
}
|
103
|
-
})
|
110
|
+
})
|
111
|
+
});
|
112
|
+
|
113
|
+
function addTab(record) {
|
114
|
+
++index;
|
115
|
+
tabs.add({
|
116
|
+
id: "tab_" + record.data['id'],
|
117
|
+
title: record.data['title'],
|
118
|
+
html: record.data['documented_item_published_content_html'],
|
119
|
+
closable: true
|
120
|
+
}).show();
|
121
|
+
}
|
122
|
+
|
123
|
+
var fitted_panel = Ext.createWidget('panel', {
|
124
|
+
id: 'fitted_panel',
|
125
|
+
layout: 'border',
|
126
|
+
header: false,
|
127
|
+
defaults: {
|
128
|
+
collapsible: true,
|
129
|
+
split: true,
|
130
|
+
},
|
131
|
+
renderTo: 'document_content',
|
132
|
+
autoScroll: true,
|
133
|
+
items: [
|
134
|
+
tree,
|
135
|
+
tabs
|
136
|
+
]
|
137
|
+
});
|
138
|
+
|
139
|
+
resize_windows();
|
140
|
+
|
104
141
|
});
|
105
|
-
|
106
|
-
|
107
|
-
|
108
|
-
|
109
|
-
|
110
|
-
|
111
|
-
|
112
|
-
|
113
|
-
|
114
|
-
|
115
|
-
|
116
|
-
|
117
|
-
|
118
|
-
|
119
|
-
header: false,
|
120
|
-
defaults: {
|
121
|
-
collapsible: true,
|
122
|
-
split: true,
|
123
|
-
},
|
124
|
-
renderTo: 'document_content',
|
125
|
-
autoScroll: true,
|
126
|
-
items: [
|
127
|
-
tree,
|
128
|
-
tabs
|
129
|
-
]
|
130
|
-
});
|
131
|
-
|
132
|
-
resize_windows();
|
133
|
-
|
134
|
-
});
|
135
|
-
|
136
|
-
function resize_windows(){
|
137
|
-
window_height = Ext.getBody().getViewSize().height;
|
138
|
-
header_height = Ext.get("header").getHeight();
|
139
|
-
footer_height = Ext.get("footer").getHeight();
|
140
|
-
document_content_height = window_height - header_height - footer_height;
|
141
|
-
Ext.get("document_content").setHeight(document_content_height);
|
142
|
-
Ext.getCmp("fitted_panel").setHeight(document_content_height - 20);
|
143
|
-
}
|
144
|
-
|
145
|
-
window.onresize = function(){
|
146
|
-
resize_windows();
|
147
|
-
}
|
148
|
-
|
142
|
+
|
143
|
+
function resize_windows() {
|
144
|
+
window_height = Ext.getBody().getViewSize().height;
|
145
|
+
header_height = Ext.get("header").getHeight();
|
146
|
+
footer_height = Ext.get("footer").getHeight();
|
147
|
+
document_content_height = window_height - header_height - footer_height;
|
148
|
+
Ext.get("document_content").setHeight(document_content_height);
|
149
|
+
Ext.getCmp("fitted_panel").setHeight(document_content_height - 20);
|
150
|
+
}
|
151
|
+
|
152
|
+
window.onresize = function () {
|
153
|
+
resize_windows();
|
154
|
+
}
|
155
|
+
|
149
156
|
</script>
|
@@ -12,8 +12,8 @@
|
|
12
12
|
|
13
13
|
<title><%= @website.title %></title>
|
14
14
|
<%= javascript_include_tag :application %>
|
15
|
-
<%= include_extjs %>
|
16
|
-
|
15
|
+
<%= include_extjs :theme => 'extjs:ext-all-gray' %>
|
16
|
+
<%= add_authenticity_token_to_extjs %>
|
17
17
|
<%= static_javascript_include_tag('erp_app/jquery_support.js') %>
|
18
18
|
<%= static_javascript_include_tag('datepicker.js') %>
|
19
19
|
<%= static_stylesheet_link_tag('datepicker.css') %>
|
@@ -1,6 +1,8 @@
|
|
1
1
|
Compass.ErpApp.Widgets.ContactUs = {
|
2
|
+
template: new Ext.Template('<%= render_widget :contact_us, :params => {:use_dynamic_form => false} %>'),
|
3
|
+
|
2
4
|
addContactUs:function(){
|
3
|
-
Ext.getCmp('knitkitCenterRegion').addContentToActiveCodeMirror(
|
5
|
+
Ext.getCmp('knitkitCenterRegion').addContentToActiveCodeMirror(Compass.ErpApp.Widgets.ContactUs.template.apply());
|
4
6
|
}
|
5
7
|
}
|
6
8
|
|