knitkit 2.0.0 → 2.0.1
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/README.md +22 -0
- data/app/controllers/knitkit/base_controller.rb +15 -2
- data/app/controllers/knitkit/blogs_controller.rb +4 -4
- data/app/controllers/knitkit/erp_app/desktop/app_controller.rb +16 -2
- data/app/controllers/knitkit/erp_app/desktop/articles_controller.rb +198 -57
- data/app/controllers/knitkit/erp_app/desktop/content_controller.rb +25 -11
- data/app/controllers/knitkit/erp_app/desktop/file_assets_controller.rb +123 -44
- data/app/controllers/knitkit/erp_app/desktop/image_assets_controller.rb +83 -9
- data/app/controllers/knitkit/erp_app/desktop/online_document_sections_controller.rb +38 -0
- data/app/controllers/knitkit/erp_app/desktop/position_controller.rb +15 -6
- data/app/controllers/knitkit/erp_app/desktop/theme_controller.rb +185 -98
- data/app/controllers/knitkit/erp_app/desktop/versions_controller.rb +38 -16
- data/app/controllers/knitkit/erp_app/desktop/website_controller.rb +126 -68
- data/app/controllers/knitkit/erp_app/desktop/website_nav_controller.rb +154 -107
- data/app/controllers/knitkit/erp_app/desktop/website_section_controller.rb +113 -54
- data/app/controllers/knitkit/online_document_sections_controller.rb +45 -0
- data/app/controllers/knitkit/unauthorized_controller.rb +5 -0
- data/app/controllers/knitkit/website_sections_controller.rb +8 -9
- data/app/mailers/document_mailer.rb +10 -0
- data/app/models/article.rb +1 -1
- data/app/models/content.rb +35 -3
- data/app/models/document.rb +8 -0
- data/app/models/document_type.rb +3 -0
- data/app/models/documented_content.rb +29 -0
- data/app/models/documented_item.rb +31 -0
- data/app/models/extensions/configuration.rb +5 -0
- data/app/models/extensions/party.rb +13 -0
- data/app/models/online_document_section.rb +40 -0
- data/app/models/theme.rb +22 -26
- data/app/models/valid_document.rb +4 -0
- data/app/models/website.rb +158 -119
- data/app/models/website_inquiry.rb +7 -2
- data/app/models/website_inquiry_mailer.rb +4 -3
- data/app/models/website_party_role.rb +5 -0
- data/app/models/website_section.rb +76 -38
- data/app/views/document_mailer/email_document.html.erb +12 -0
- data/app/views/knitkit/blogs/_add_comment.html.erb +2 -2
- data/app/views/knitkit/online_document_sections/index.html.erb +149 -0
- data/app/views/knitkit/website_sections/index.html.erb +0 -1
- data/app/views/layouts/knitkit/base.html.erb +4 -2
- data/app/views/layouts/knitkit/online_document_sections.html.erb +59 -0
- data/app/views/menus/knitkit/_default_menu.html.erb +1 -1
- data/app/views/menus/knitkit/_default_section_menu.html.erb +1 -1
- data/app/views/menus/knitkit/_default_sub_menu.html.erb +2 -2
- data/app/views/menus/knitkit/_default_sub_section_menu.html.erb +1 -1
- data/app/widgets/contact_us/base.rb +5 -5
- data/app/widgets/contact_us/javascript/contact_us.js +2 -1
- data/app/widgets/google_map/base.rb +0 -4
- data/app/widgets/google_map/javascript/google_map.js +4 -3
- data/app/widgets/login/base.rb +0 -5
- data/app/widgets/login/javascript/login.js +155 -153
- data/app/widgets/login/views/index.html.erb +3 -3
- data/app/widgets/login/views/reset_password.html.erb +2 -2
- data/app/widgets/manage_profile/base.rb +46 -67
- data/app/widgets/manage_profile/javascript/manage_profile.js +2 -1
- data/app/widgets/manage_profile/views/_user_information_form.html.erb +5 -1
- data/app/widgets/reset_password/base.rb +4 -6
- data/app/widgets/reset_password/javascript/reset_password.js +2 -1
- data/app/widgets/reset_password/views/index.html.erb +4 -3
- data/app/widgets/search/base.rb +1 -5
- data/app/widgets/search/javascript/search.js +2 -1
- data/app/widgets/search/views/show.html.erb +2 -2
- data/app/widgets/signup/base.rb +7 -6
- data/app/widgets/signup/javascript/signup.js +2 -1
- data/app/widgets/signup/views/error.html.erb +1 -1
- data/config/routes.rb +6 -2
- data/db/data_migrations/20110509223702_add_publisher_role.rb +10 -0
- data/db/data_migrations/20111118182910_setup_knitkit_capabilities.rb +84 -0
- data/db/data_migrations/20120127144444_create_website_role_types.rb +13 -0
- data/db/data_migrations/20120127150505_create_website_default_configuration.rb +72 -0
- data/db/data_migrations/20120127150506_add_primary_host_to_website_configuration.rb +33 -0
- data/db/data_migrations/20120316150424_add_is_template_to_default_website_config.rb +16 -0
- data/db/data_migrations/upgrade/20120210195616_add_website_configs.rb +19 -0
- data/db/data_migrations/upgrade/20120213205519_populate_website_iids.rb +17 -0
- data/db/migrate/20110211002317_setup_knitkit.rb +22 -5
- data/db/migrate/20111207161928_create_documented_items_table.rb +13 -0
- data/db/migrate/20111208180539_add_document_id_to_documented_item.rb +9 -0
- data/db/migrate/20120315163736_add_document.rb +32 -0
- data/db/migrate/20120503183431_create_valid_documents.rb +16 -0
- data/db/migrate/upgrade/20120116201510_add_render_base_layout_flag.rb +13 -0
- data/db/migrate/upgrade/20120127143745_create_website_party_roles.rb +24 -0
- data/db/migrate/upgrade/20120213184509_add_iid_to_websites.rb +14 -0
- data/lib/knitkit.rb +2 -0
- data/lib/knitkit/config.rb +31 -0
- data/lib/knitkit/engine.rb +12 -3
- data/lib/knitkit/extensions.rb +1 -3
- data/lib/knitkit/extensions/action_controller/theme_support/acts_as_themed_controller.rb +2 -3
- data/lib/knitkit/extensions/active_record/acts_as_document.rb +63 -0
- data/lib/knitkit/extensions/active_record/acts_as_publishable.rb +5 -4
- data/lib/knitkit/extensions/compass_ae/widgets/base.rb +70 -0
- data/lib/knitkit/extensions/railties/action_view.rb +22 -10
- data/lib/knitkit/extensions/railties/theme_support/asset_tag_helper.rb +3 -3
- data/lib/knitkit/extensions/railties/theme_support/theme_file_resolver.rb +8 -3
- data/lib/knitkit/routing_filter/section_router.rb +16 -6
- data/lib/knitkit/version.rb +7 -1
- data/public/images/check.png +0 -0
- data/public/images/credit_card.png +0 -0
- data/public/images/knitkit/tooltip.gif +0 -0
- data/public/javascripts/ajax_pagination.js +33 -0
- data/public/javascripts/datepicker.js +6 -1
- data/public/javascripts/erp_app/desktop/applications/knitkit/articles_grid_panel.js +731 -258
- data/public/javascripts/erp_app/desktop/applications/knitkit/center_region.js +289 -238
- data/public/javascripts/erp_app/desktop/applications/knitkit/comments_grid_panel.js +2 -4
- data/public/javascripts/erp_app/desktop/applications/knitkit/east_region.js +29 -3
- data/public/javascripts/erp_app/desktop/applications/knitkit/file_assets_panel.js +193 -21
- data/public/javascripts/erp_app/desktop/applications/knitkit/image_assets_data_view.js +27 -26
- data/public/javascripts/erp_app/desktop/applications/knitkit/image_assets_panel.js +167 -20
- data/public/javascripts/erp_app/desktop/applications/knitkit/inquiries_grid_panel.js +1 -2
- data/public/javascripts/erp_app/desktop/applications/knitkit/module.js +5 -1
- data/public/javascripts/erp_app/desktop/applications/knitkit/publish_window.js +2 -2
- data/public/javascripts/erp_app/desktop/applications/knitkit/published_grid_panel.js +20 -11
- data/public/javascripts/erp_app/desktop/applications/knitkit/section_articles_grid_panel.js +279 -228
- data/public/javascripts/erp_app/desktop/applications/knitkit/themes_tree_panel.js +40 -40
- data/public/javascripts/erp_app/desktop/applications/knitkit/versions_grid_panel.js +83 -76
- data/public/javascripts/erp_app/desktop/applications/knitkit/west_region.js +1961 -1397
- data/public/javascripts/erp_app/desktop/applications/knitkit/widgets_panel.js +47 -43
- data/public/javascripts/knitkit/helpers.js +26 -0
- data/public/stylesheets/erp_app/desktop/applications/knitkit/knitkit.css +1 -2
- data/public/stylesheets/knitkit/documentation.css +50 -0
- data/public/stylesheets/knitkit/style.css +23 -1
- data/spec/controllers/knitkit/erp_app/desktop/articles_controller_spec.rb +8 -0
- data/spec/controllers/knitkit/erp_app/desktop/website_controller_spec.rb +396 -0
- data/spec/controllers/knitkit/erp_app/desktop/website_nav_controller_spec.rb +260 -0
- data/spec/controllers/knitkit/erp_app/desktop/website_section_controller_spec.rb +222 -0
- data/spec/dummy/Rakefile +7 -0
- data/spec/dummy/app/assets/javascripts/application.js +9 -0
- data/spec/dummy/app/assets/stylesheets/application.css +7 -0
- data/spec/dummy/app/controllers/application_controller.rb +3 -0
- data/spec/dummy/app/helpers/application_helper.rb +2 -0
- data/spec/dummy/app/views/layouts/application.html.erb +14 -0
- data/spec/dummy/config.ru +4 -0
- data/spec/dummy/config/application.rb +43 -0
- data/spec/dummy/config/boot.rb +10 -0
- data/spec/dummy/config/database.yml +8 -0
- data/spec/dummy/config/environment.rb +5 -0
- data/spec/dummy/config/environments/spec.rb +27 -0
- data/spec/dummy/config/initializers/backtrace_silencers.rb +7 -0
- data/spec/dummy/config/initializers/inflections.rb +10 -0
- data/spec/dummy/config/initializers/mime_types.rb +5 -0
- data/spec/dummy/config/initializers/secret_token.rb +7 -0
- data/spec/dummy/config/initializers/session_store.rb +8 -0
- data/spec/dummy/config/initializers/wrap_parameters.rb +12 -0
- data/spec/dummy/config/locales/en.yml +5 -0
- data/spec/dummy/config/routes.rb +4 -0
- data/spec/dummy/config/workflow.yml +1 -0
- data/spec/dummy/public/404.html +26 -0
- data/spec/dummy/public/422.html +26 -0
- data/spec/dummy/public/500.html +26 -0
- data/spec/dummy/public/favicon.ico +0 -0
- data/spec/dummy/script/rails +6 -0
- data/spec/factories/article.rb +4 -0
- data/spec/factories/basic.rb +3 -0
- data/spec/factories/blog.rb +5 -0
- data/spec/factories/documented_content.rb +4 -0
- data/spec/factories/documented_item.rb +4 -0
- data/spec/factories/online_document_section.rb +6 -0
- data/spec/factories/published_website.rb +4 -0
- data/spec/factories/theme.rb +6 -0
- data/spec/factories/website.rb +5 -0
- data/spec/factories/website_host.rb +4 -0
- data/spec/factories/website_nav.rb +5 -0
- data/spec/factories/website_nav_item.rb +4 -0
- data/spec/factories/website_section.rb +5 -0
- data/spec/models/article_spec.rb +35 -0
- data/spec/models/attribute_type_spec.rb +55 -0
- data/spec/models/attribute_value_spec.rb +114 -0
- data/spec/models/blog_spec.rb +16 -0
- data/spec/models/comment_spec.rb +11 -0
- data/spec/models/content_spec.rb +187 -0
- data/spec/models/documented_item_spec.rb +29 -0
- data/spec/models/online_document_section_spec.rb +34 -0
- data/spec/models/published_element_spec.rb +11 -0
- data/spec/models/published_website_spec.rb +11 -0
- data/spec/models/theme_spec.rb +12 -0
- data/spec/models/website_host_spec.rb +11 -0
- data/spec/models/website_inquiry_spec.rb +24 -0
- data/spec/models/website_nav_item_spec.rb +11 -0
- data/spec/models/website_nav_spec.rb +11 -0
- data/spec/models/website_section_content_spec.rb +11 -0
- data/spec/models/website_section_spec.rb +49 -0
- data/spec/models/website_spec.rb +146 -0
- data/spec/spec_helper.rb +61 -0
- metadata +391 -154
- data/app/controllers/knitkit/articles_controller.rb +0 -7
- data/lib/knitkit/extensions/compass/widgets/base.rb +0 -53
|
@@ -5,7 +5,12 @@ class WebsiteInquiry < ActiveRecord::Base
|
|
|
5
5
|
has_dynamic_forms
|
|
6
6
|
has_dynamic_data
|
|
7
7
|
|
|
8
|
-
def send_email
|
|
9
|
-
|
|
8
|
+
def send_email(subject='')
|
|
9
|
+
begin
|
|
10
|
+
WebsiteInquiryMailer.inquiry(self, subject).deliver
|
|
11
|
+
rescue Exception => e
|
|
12
|
+
system_user = Party.find_by_description('Compass AE')
|
|
13
|
+
AuditLog.custom_application_log_message(system_user, e)
|
|
14
|
+
end
|
|
10
15
|
end
|
|
11
16
|
end
|
|
@@ -1,10 +1,11 @@
|
|
|
1
1
|
class WebsiteInquiryMailer < ActionMailer::Base
|
|
2
2
|
|
|
3
|
-
def inquiry(website_inquiry)
|
|
3
|
+
def inquiry(website_inquiry, subject='')
|
|
4
|
+
subject = "#{website_inquiry.website.title} Inquiry" if subject.blank?
|
|
4
5
|
@website_inquiry = website_inquiry
|
|
5
|
-
mail( :to => website_inquiry.website.
|
|
6
|
+
mail( :to => website_inquiry.website.configurations.first.get_item(ConfigurationItemType.find_by_internal_identifier('contact_us_email_address')).options.first.value,
|
|
6
7
|
:from => website_inquiry.data.dyn_email,
|
|
7
|
-
:subject =>
|
|
8
|
+
:subject => subject,
|
|
8
9
|
:content_type => 'text/plain'
|
|
9
10
|
)
|
|
10
11
|
end
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
class WebsiteSection < ActiveRecord::Base
|
|
2
|
-
|
|
2
|
+
after_create :update_paths
|
|
3
|
+
before_save :update_path, :check_internal_indentifier
|
|
3
4
|
|
|
4
5
|
has_permalink :title, :url_attribute => :permalink, :sync_url => true, :only_when_blank => true, :scope => [:website_id, :parent_id]
|
|
5
6
|
acts_as_nested_set
|
|
@@ -7,7 +8,7 @@ class WebsiteSection < ActiveRecord::Base
|
|
|
7
8
|
acts_as_versioned :table_name => :website_section_versions, :non_versioned_columns => %w{parent_id lft rgt}
|
|
8
9
|
can_be_published
|
|
9
10
|
has_roles
|
|
10
|
-
|
|
11
|
+
|
|
11
12
|
belongs_to :website
|
|
12
13
|
has_many :website_section_contents, :dependent => :destroy
|
|
13
14
|
has_many :contents, :through => :website_section_contents
|
|
@@ -15,35 +16,40 @@ class WebsiteSection < ActiveRecord::Base
|
|
|
15
16
|
validates :title, :presence => {:message => 'Title cannot be blank'}
|
|
16
17
|
validates_uniqueness_of :permalink, :scope => [:website_id, :parent_id]
|
|
17
18
|
validates_uniqueness_of :internal_identifier, :scope => :website_id
|
|
18
|
-
|
|
19
|
-
after_create :update_paths
|
|
20
|
-
before_save :update_path, :check_internal_indentifier
|
|
21
|
-
|
|
19
|
+
|
|
22
20
|
KNIT_KIT_ROOT = Knitkit::Engine.root.to_s
|
|
23
21
|
WEBSITE_SECTIONS_TEMP_LAYOUT_PATH = "#{Knitkit::Engine.root.to_s}/app/views/knitkit/website_sections"
|
|
24
|
-
|
|
22
|
+
|
|
25
23
|
@@types = ['Page']
|
|
26
24
|
cattr_reader :types
|
|
27
25
|
|
|
28
|
-
def articles
|
|
29
|
-
Article.find_by_section_id(self.id)
|
|
30
|
-
end
|
|
31
|
-
|
|
32
|
-
def website
|
|
33
|
-
website_id.nil? ? self.parent.website : Website.find(website_id)
|
|
34
|
-
end
|
|
35
|
-
|
|
36
26
|
class << self
|
|
37
27
|
def register_type(type)
|
|
38
28
|
@@types << type
|
|
39
29
|
@@types.uniq!
|
|
40
30
|
end
|
|
41
31
|
end
|
|
42
|
-
|
|
32
|
+
|
|
33
|
+
def iid
|
|
34
|
+
internal_identifier
|
|
35
|
+
end
|
|
36
|
+
|
|
37
|
+
def articles
|
|
38
|
+
Article.find_by_section_id(self.id)
|
|
39
|
+
end
|
|
40
|
+
|
|
41
|
+
def website
|
|
42
|
+
website_id.nil? ? self.parent.website : Website.find(website_id)
|
|
43
|
+
end
|
|
44
|
+
|
|
45
|
+
def render_base_layout?
|
|
46
|
+
render_base_layout
|
|
47
|
+
end
|
|
48
|
+
|
|
43
49
|
def positioned_children
|
|
44
50
|
children.sort_by{|child| [child.position]}
|
|
45
51
|
end
|
|
46
|
-
|
|
52
|
+
|
|
47
53
|
def paths
|
|
48
54
|
all_paths = [self.path]
|
|
49
55
|
all_paths | self.descendants.collect(&:path)
|
|
@@ -52,10 +58,18 @@ class WebsiteSection < ActiveRecord::Base
|
|
|
52
58
|
def child_by_path(path)
|
|
53
59
|
self.descendants.detect{|child| child.path == path}
|
|
54
60
|
end
|
|
55
|
-
|
|
61
|
+
|
|
56
62
|
def type
|
|
57
63
|
read_attribute(:type) || 'Page'
|
|
58
64
|
end
|
|
65
|
+
|
|
66
|
+
def is_section?
|
|
67
|
+
['Page', 'Blog'].include? type
|
|
68
|
+
end
|
|
69
|
+
|
|
70
|
+
def is_document_section?
|
|
71
|
+
type == 'OnlineDocumentSection'
|
|
72
|
+
end
|
|
59
73
|
|
|
60
74
|
def create_layout
|
|
61
75
|
self.layout = IO.read(File.join(WEBSITE_SECTIONS_TEMP_LAYOUT_PATH,"index.html.erb"))
|
|
@@ -77,32 +91,21 @@ class WebsiteSection < ActiveRecord::Base
|
|
|
77
91
|
def get_tags
|
|
78
92
|
get_topics
|
|
79
93
|
end
|
|
80
|
-
|
|
94
|
+
|
|
81
95
|
def get_topics
|
|
82
96
|
# leaving this here for reference until we're sure the built in method tag_counts_on does what we need
|
|
83
|
-
# sql = "SELECT tags.*, taggings.tags_count AS count FROM \"tags\"
|
|
84
|
-
# JOIN (SELECT taggings.tag_id, COUNT(taggings.tag_id) AS tags_count FROM \"taggings\"
|
|
85
|
-
# INNER JOIN contents ON contents.id = taggings.taggable_id AND contents.type = 'Article'
|
|
86
|
-
# INNER JOIN website_section_contents ON contents.id=website_section_contents.content_id
|
|
87
|
-
# WHERE (taggings.taggable_type = 'Content' AND taggings.context = 'tags')
|
|
97
|
+
# sql = "SELECT tags.*, taggings.tags_count AS count FROM \"tags\"
|
|
98
|
+
# JOIN (SELECT taggings.tag_id, COUNT(taggings.tag_id) AS tags_count FROM \"taggings\"
|
|
99
|
+
# INNER JOIN contents ON contents.id = taggings.taggable_id AND contents.type = 'Article'
|
|
100
|
+
# INNER JOIN website_section_contents ON contents.id=website_section_contents.content_id
|
|
101
|
+
# WHERE (taggings.taggable_type = 'Content' AND taggings.context = 'tags')
|
|
88
102
|
# AND website_section_contents.website_section_id=#{self.id}
|
|
89
|
-
# GROUP BY taggings.tag_id HAVING COUNT(*) > 0 AND COUNT(taggings.tag_id) > 0)
|
|
103
|
+
# GROUP BY taggings.tag_id HAVING COUNT(*) > 0 AND COUNT(taggings.tag_id) > 0)
|
|
90
104
|
# AS taggings ON taggings.tag_id = tags.id
|
|
91
105
|
# ORDER BY tags.name ASC"
|
|
92
106
|
# ActsAsTaggableOn::Tag.find_by_sql(sql)
|
|
93
107
|
|
|
94
|
-
self.contents.tag_counts_on(:tags).sort_by{|t| t.name }
|
|
95
|
-
end
|
|
96
|
-
|
|
97
|
-
# Before destroying a section look at content belonging to this section
|
|
98
|
-
# and destroy content that does NOT belong to any OTHER section
|
|
99
|
-
def destroy_content
|
|
100
|
-
self.contents.each do |c|
|
|
101
|
-
unless c.website_sections.count > 1
|
|
102
|
-
puts "destroying"
|
|
103
|
-
c.destroy
|
|
104
|
-
end
|
|
105
|
-
end
|
|
108
|
+
self.contents.tag_counts_on(:tags).sort_by{|t| t.name }
|
|
106
109
|
end
|
|
107
110
|
|
|
108
111
|
def update_path!
|
|
@@ -110,6 +113,39 @@ class WebsiteSection < ActiveRecord::Base
|
|
|
110
113
|
self.path = new_path unless self.path == new_path
|
|
111
114
|
self.save
|
|
112
115
|
end
|
|
116
|
+
|
|
117
|
+
def build_section_hash
|
|
118
|
+
section_hash = {
|
|
119
|
+
:name => self.title,
|
|
120
|
+
:has_layout => !self.layout.blank?,
|
|
121
|
+
:type => self.class.to_s,
|
|
122
|
+
:in_menu => self.in_menu,
|
|
123
|
+
:articles => [],
|
|
124
|
+
:roles => self.roles.collect{|role| role.internal_identifier},
|
|
125
|
+
:path => self.path,
|
|
126
|
+
:permalink => self.permalink,
|
|
127
|
+
:internal_identifier => self.internal_identifier,
|
|
128
|
+
:render_base_layout => self.render_base_layout,
|
|
129
|
+
:position => self.position,
|
|
130
|
+
:sections => self.children.each.map{|child| child.build_section_hash}
|
|
131
|
+
}
|
|
132
|
+
|
|
133
|
+
self.contents.each do |content|
|
|
134
|
+
content_area = content.content_area_by_website_section(self)
|
|
135
|
+
position = content.position_by_website_section(self)
|
|
136
|
+
section_hash[:articles] << {
|
|
137
|
+
:name => content.title,
|
|
138
|
+
:tag_list => content.tag_list.join(', '),
|
|
139
|
+
:content_area => content_area,
|
|
140
|
+
:position => position,
|
|
141
|
+
:display_title => content.display_title,
|
|
142
|
+
:internal_identifier => content.internal_identifier
|
|
143
|
+
}
|
|
144
|
+
end
|
|
145
|
+
|
|
146
|
+
section_hash
|
|
147
|
+
end
|
|
148
|
+
|
|
113
149
|
|
|
114
150
|
protected
|
|
115
151
|
|
|
@@ -134,6 +170,8 @@ class WebsiteSection < ActiveRecord::Base
|
|
|
134
170
|
def check_internal_indentifier
|
|
135
171
|
self.internal_identifier = self.permalink if self.internal_identifier.blank?
|
|
136
172
|
end
|
|
173
|
+
|
|
174
|
+
|
|
137
175
|
|
|
138
176
|
private
|
|
139
177
|
|
|
@@ -146,7 +184,7 @@ class WebsiteSection < ActiveRecord::Base
|
|
|
146
184
|
end
|
|
147
185
|
content_version
|
|
148
186
|
end
|
|
149
|
-
|
|
187
|
+
|
|
150
188
|
end
|
|
151
189
|
|
|
152
190
|
|
|
@@ -22,7 +22,7 @@
|
|
|
22
22
|
</div>
|
|
23
23
|
|
|
24
24
|
<script type="text/javascript">
|
|
25
|
-
|
|
26
|
-
|
|
25
|
+
jQuery('#add_comment_form').bind('ajaxComplete', function(e, xhr, settings){
|
|
26
|
+
jQuery('#notice').html(xhr.responseText);
|
|
27
27
|
});
|
|
28
28
|
</script>
|
|
@@ -0,0 +1,149 @@
|
|
|
1
|
+
<div id="document_content">
|
|
2
|
+
</div>
|
|
3
|
+
|
|
4
|
+
<script type="text/javascript" charset="utf-8">
|
|
5
|
+
|
|
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: new 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:[ { name:'id' }, { name:'title' }, { name:'documented_item_published_content_html' }, { name:'leaf' }]
|
|
26
|
+
}),
|
|
27
|
+
collapsible: true,
|
|
28
|
+
tbar: {
|
|
29
|
+
items: [
|
|
30
|
+
new Ext.form.TextField({
|
|
31
|
+
id:"search",
|
|
32
|
+
disabled: true,
|
|
33
|
+
cls: 'document_search',
|
|
34
|
+
emptyText: 'Search',
|
|
35
|
+
allowBlank:true,
|
|
36
|
+
})
|
|
37
|
+
]
|
|
38
|
+
},
|
|
39
|
+
header: false,
|
|
40
|
+
autoScroll: true,
|
|
41
|
+
bodyBorder: false,
|
|
42
|
+
rootVisible: false,
|
|
43
|
+
width: 170,
|
|
44
|
+
displayField: 'title',
|
|
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: {
|
|
71
|
+
autoScroll: true,
|
|
72
|
+
bodyPadding: 10,
|
|
73
|
+
},
|
|
74
|
+
items: [{
|
|
75
|
+
id: "tab_" + <%= @root.id.to_s %>,
|
|
76
|
+
title: '<%= @root.title %>',
|
|
77
|
+
html: "<%= raw @root_content.gsub(/\n/, '<br/>') %>",
|
|
78
|
+
closable: false,
|
|
79
|
+
autoScroll: true
|
|
80
|
+
}],
|
|
81
|
+
plugins: Ext.create('Ext.ux.TabCloseMenu', {
|
|
82
|
+
extraItemsTail: [
|
|
83
|
+
'-',
|
|
84
|
+
{
|
|
85
|
+
text: 'Closable',
|
|
86
|
+
checked: true,
|
|
87
|
+
hideOnClick: true,
|
|
88
|
+
handler: function (item) {
|
|
89
|
+
currentItem.tab.setClosable(item.checked);
|
|
90
|
+
}
|
|
91
|
+
}
|
|
92
|
+
],
|
|
93
|
+
listeners: {
|
|
94
|
+
aftermenu: function () {
|
|
95
|
+
currentItem = null;
|
|
96
|
+
},
|
|
97
|
+
beforemenu: function (menu, item) {
|
|
98
|
+
var menuitem = menu.child('*[text="Closable"]');
|
|
99
|
+
currentItem = item;
|
|
100
|
+
menuitem.setChecked(item.closable);
|
|
101
|
+
}
|
|
102
|
+
}
|
|
103
|
+
})
|
|
104
|
+
});
|
|
105
|
+
|
|
106
|
+
function addTab(record){
|
|
107
|
+
++index;
|
|
108
|
+
tabs.add({
|
|
109
|
+
id: "tab_" + record.data['id'],
|
|
110
|
+
title: record.data['title'],
|
|
111
|
+
html: record.data['documented_item_published_content_html'],
|
|
112
|
+
closable: true
|
|
113
|
+
}).show();
|
|
114
|
+
}
|
|
115
|
+
|
|
116
|
+
var fitted_panel = Ext.createWidget('panel', {
|
|
117
|
+
id: 'fitted_panel',
|
|
118
|
+
layout: 'border',
|
|
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
|
+
|
|
149
|
+
</script>
|
|
@@ -13,15 +13,17 @@
|
|
|
13
13
|
<title><%= @website.title %></title>
|
|
14
14
|
<%= javascript_include_tag :application %>
|
|
15
15
|
<%= include_extjs %>
|
|
16
|
+
<%= static_javascript_include_tag('erp_app/utility.js') %>
|
|
17
|
+
<%= add_authenticity_token_to_extjs %>
|
|
16
18
|
<%= static_javascript_include_tag('erp_app/jquery_support.js') %>
|
|
17
19
|
<%= static_javascript_include_tag('datepicker.js') %>
|
|
18
20
|
<%= static_stylesheet_link_tag('datepicker.css') %>
|
|
19
|
-
<%= static_javascript_include_tag('erp_app/utility.js') %>
|
|
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
|
-
<%= static_javascript_include_tag('
|
|
24
|
+
<%= static_javascript_include_tag('ajax_pagination.js') %>
|
|
24
25
|
<%= static_javascript_include_tag('erp_app/shared/dynamic_forms/dynamic_forms_validation.js') %>
|
|
26
|
+
<%= static_javascript_include_tag('knitkit/helpers.js') %>
|
|
25
27
|
<%= yield :head %>
|
|
26
28
|
</head>
|
|
27
29
|
<body>
|
|
@@ -0,0 +1,59 @@
|
|
|
1
|
+
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml2/DTD/xhtml1-strict.dtd">
|
|
2
|
+
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en">
|
|
3
|
+
<head>
|
|
4
|
+
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />
|
|
5
|
+
<meta name="generator" content="Knitkit - Compass AE Open source content management platform" />
|
|
6
|
+
|
|
7
|
+
<meta name="description" content="" />
|
|
8
|
+
<meta name="keywords" content="" />
|
|
9
|
+
<meta name="copyright" content="©" />
|
|
10
|
+
<meta name="robots" content="ALL" />
|
|
11
|
+
<meta name="language" content="English" />
|
|
12
|
+
|
|
13
|
+
<title><%= @website.title %></title>
|
|
14
|
+
<%= javascript_include_tag :application %>
|
|
15
|
+
<%= include_extjs %>
|
|
16
|
+
<%= add_authenticity_token_to_extjs %>
|
|
17
|
+
<%= static_javascript_include_tag('erp_app/jquery_support.js') %>
|
|
18
|
+
<%= static_javascript_include_tag('datepicker.js') %>
|
|
19
|
+
<%= static_stylesheet_link_tag('datepicker.css') %>
|
|
20
|
+
<%= static_javascript_include_tag('erp_app/utility.js') %>
|
|
21
|
+
<%= static_stylesheet_link_tag('knitkit/style.css') %>
|
|
22
|
+
<%= static_javascript_include_tag('erp_app/widgets.js') %>
|
|
23
|
+
<%= static_javascript_include_tag('ajax_pagination.js') %>
|
|
24
|
+
<%= static_javascript_include_tag('erp_app/shared/dynamic_forms/dynamic_forms_validation.js') %>
|
|
25
|
+
<%= static_stylesheet_link_tag('knitkit/documentation.css') %>
|
|
26
|
+
<%= yield :head %>
|
|
27
|
+
<!--[if !IE 7]>
|
|
28
|
+
<style type="text/css">
|
|
29
|
+
#main {display:table;height:100%}
|
|
30
|
+
</style>
|
|
31
|
+
<![endif]-->
|
|
32
|
+
</head>
|
|
33
|
+
<body>
|
|
34
|
+
<div id="main">
|
|
35
|
+
<div id="header">
|
|
36
|
+
<div id="logo">
|
|
37
|
+
<%=render_version_viewing%>
|
|
38
|
+
<%= render_widget :login,
|
|
39
|
+
:action => :login_header,
|
|
40
|
+
:params => {:login_url => '/login',
|
|
41
|
+
:signup_url => '/sign-up'}%>
|
|
42
|
+
<div id="logo_text">
|
|
43
|
+
<!-- class="logo_color", allows you to change the color of the text -->
|
|
44
|
+
<h1><a href="/"><%= @website.title %></a></h1>
|
|
45
|
+
<h2><%= @website.subtitle %></h2>
|
|
46
|
+
</div>
|
|
47
|
+
</div>
|
|
48
|
+
<%= content_for?(:menu) ? yield(:menu) : render_menu(@contents) %>
|
|
49
|
+
<%#=render_menu(@contents, :menu => 'main')%>
|
|
50
|
+
</div>
|
|
51
|
+
|
|
52
|
+
<%= yield %>
|
|
53
|
+
</div>
|
|
54
|
+
<div id="content_footer"></div>
|
|
55
|
+
<%= content_for?(:footer) ? yield(:footer) : (render :partial => 'shared/knitkit/footer') %>
|
|
56
|
+
<%= yield :foot %>
|
|
57
|
+
</body>
|
|
58
|
+
</html>
|
|
59
|
+
|