knitkit 2.0.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (165) hide show
  1. data/GPL-3-LICENSE +674 -0
  2. data/README.md +6 -0
  3. data/Rakefile +30 -0
  4. data/app/assets/javascripts/knitkit/application.js +9 -0
  5. data/app/assets/stylesheets/knitkit/application.css +7 -0
  6. data/app/controllers/knitkit/articles_controller.rb +7 -0
  7. data/app/controllers/knitkit/base_controller.rb +45 -0
  8. data/app/controllers/knitkit/blogs_controller.rb +27 -0
  9. data/app/controllers/knitkit/comments_controller.rb +18 -0
  10. data/app/controllers/knitkit/erp_app/desktop/app_controller.rb +135 -0
  11. data/app/controllers/knitkit/erp_app/desktop/articles_controller.rb +144 -0
  12. data/app/controllers/knitkit/erp_app/desktop/comments_controller.rb +43 -0
  13. data/app/controllers/knitkit/erp_app/desktop/content_controller.rb +27 -0
  14. data/app/controllers/knitkit/erp_app/desktop/file_assets_controller.rb +145 -0
  15. data/app/controllers/knitkit/erp_app/desktop/image_assets_controller.rb +28 -0
  16. data/app/controllers/knitkit/erp_app/desktop/inquiries_controller.rb +68 -0
  17. data/app/controllers/knitkit/erp_app/desktop/position_controller.rb +20 -0
  18. data/app/controllers/knitkit/erp_app/desktop/theme_controller.rb +272 -0
  19. data/app/controllers/knitkit/erp_app/desktop/versions_controller.rb +135 -0
  20. data/app/controllers/knitkit/erp_app/desktop/website_controller.rb +177 -0
  21. data/app/controllers/knitkit/erp_app/desktop/website_nav_controller.rb +143 -0
  22. data/app/controllers/knitkit/erp_app/desktop/website_section_controller.rb +116 -0
  23. data/app/controllers/knitkit/unauthorized_controller.rb +8 -0
  24. data/app/controllers/knitkit/website_sections_controller.rb +17 -0
  25. data/app/helpers/application_helper.rb +132 -0
  26. data/app/models/article.rb +14 -0
  27. data/app/models/blog.rb +21 -0
  28. data/app/models/comment.rb +24 -0
  29. data/app/models/content.rb +158 -0
  30. data/app/models/extensions/user.rb +5 -0
  31. data/app/models/published_element.rb +9 -0
  32. data/app/models/published_website.rb +118 -0
  33. data/app/models/theme.rb +239 -0
  34. data/app/models/website.rb +457 -0
  35. data/app/models/website_host.rb +3 -0
  36. data/app/models/website_inquiry.rb +11 -0
  37. data/app/models/website_inquiry_mailer.rb +12 -0
  38. data/app/models/website_nav.rb +17 -0
  39. data/app/models/website_nav_item.rb +21 -0
  40. data/app/models/website_section.rb +152 -0
  41. data/app/models/website_section_content.rb +4 -0
  42. data/app/views/knitkit/articles/index.html.erb +3 -0
  43. data/app/views/knitkit/articles/show.html.erb +4 -0
  44. data/app/views/knitkit/blogs/_add_comment.html.erb +28 -0
  45. data/app/views/knitkit/blogs/_comment.html.erb +8 -0
  46. data/app/views/knitkit/blogs/index.html.erb +51 -0
  47. data/app/views/knitkit/blogs/index.rss.builder +23 -0
  48. data/app/views/knitkit/blogs/show.html.erb +22 -0
  49. data/app/views/knitkit/unauthorized/index.html.erb +4 -0
  50. data/app/views/knitkit/website_sections/index.html.erb +6 -0
  51. data/app/views/layouts/knitkit/base.html.erb +59 -0
  52. data/app/views/menus/knitkit/_default_menu.html.erb +23 -0
  53. data/app/views/menus/knitkit/_default_section_menu.html.erb +27 -0
  54. data/app/views/menus/knitkit/_default_sub_menu.html.erb +45 -0
  55. data/app/views/menus/knitkit/_default_sub_section_menu.html.erb +49 -0
  56. data/app/views/shared/knitkit/_bread_crumb.html.erb +7 -0
  57. data/app/views/shared/knitkit/_footer.html.erb +3 -0
  58. data/app/views/website_inquiry_mailer/inquiry.erb +3 -0
  59. data/app/widgets/contact_us/base.rb +86 -0
  60. data/app/widgets/contact_us/javascript/contact_us.js +13 -0
  61. data/app/widgets/contact_us/views/_contact_form.html.erb +36 -0
  62. data/app/widgets/contact_us/views/error.html.erb +10 -0
  63. data/app/widgets/contact_us/views/index.html.erb +1 -0
  64. data/app/widgets/contact_us/views/layouts/base.html.erb +7 -0
  65. data/app/widgets/contact_us/views/success.html.erb +4 -0
  66. data/app/widgets/google_map/base.rb +48 -0
  67. data/app/widgets/google_map/javascript/google_map.js +174 -0
  68. data/app/widgets/google_map/views/index.html.erb +41 -0
  69. data/app/widgets/login/base.rb +61 -0
  70. data/app/widgets/login/javascript/login.js +162 -0
  71. data/app/widgets/login/views/index.html.erb +37 -0
  72. data/app/widgets/login/views/layouts/base.html.erb +14 -0
  73. data/app/widgets/login/views/login_header.html.erb +9 -0
  74. data/app/widgets/login/views/reset_password.html.erb +26 -0
  75. data/app/widgets/manage_profile/base.rb +327 -0
  76. data/app/widgets/manage_profile/javascript/manage_profile.js +11 -0
  77. data/app/widgets/manage_profile/views/_contact_information_form.html.erb +180 -0
  78. data/app/widgets/manage_profile/views/_password_form.html.erb +20 -0
  79. data/app/widgets/manage_profile/views/_user_information_form.html.erb +30 -0
  80. data/app/widgets/manage_profile/views/contact_type_in_use.html.erb +4 -0
  81. data/app/widgets/manage_profile/views/default_type_error.html.erb +5 -0
  82. data/app/widgets/manage_profile/views/error.html.erb +3 -0
  83. data/app/widgets/manage_profile/views/index.html.erb +46 -0
  84. data/app/widgets/manage_profile/views/layouts/base.html.erb +1 -0
  85. data/app/widgets/manage_profile/views/password_blank.html.erb +4 -0
  86. data/app/widgets/manage_profile/views/password_invalid.html.erb +4 -0
  87. data/app/widgets/manage_profile/views/password_success.html.erb +3 -0
  88. data/app/widgets/manage_profile/views/success.html.erb +3 -0
  89. data/app/widgets/reset_password/base.rb +42 -0
  90. data/app/widgets/reset_password/javascript/reset_password.js +13 -0
  91. data/app/widgets/reset_password/views/index.html.erb +31 -0
  92. data/app/widgets/reset_password/views/layouts/base.html.erb +1 -0
  93. data/app/widgets/search/base.rb +80 -0
  94. data/app/widgets/search/javascript/search.js +31 -0
  95. data/app/widgets/search/views/_search.html.erb +39 -0
  96. data/app/widgets/search/views/index.html.erb +3 -0
  97. data/app/widgets/search/views/layouts/base.html.erb +24 -0
  98. data/app/widgets/search/views/show.html.erb +48 -0
  99. data/app/widgets/signup/base.rb +72 -0
  100. data/app/widgets/signup/javascript/signup.js +13 -0
  101. data/app/widgets/signup/views/_signup_form.html.erb +36 -0
  102. data/app/widgets/signup/views/error.html.erb +11 -0
  103. data/app/widgets/signup/views/index.html.erb +1 -0
  104. data/app/widgets/signup/views/layouts/base.html.erb +7 -0
  105. data/app/widgets/signup/views/success.html.erb +4 -0
  106. data/config/environment.rb +0 -0
  107. data/config/routes.rb +41 -0
  108. data/db/data_migrations/20110509223702_add_publisher_role.rb +11 -0
  109. data/db/data_migrations/20110816153456_add_knitkit_application.rb +31 -0
  110. data/db/data_migrations/upgrade/20111011203718_create_paths_for_sections.rb +13 -0
  111. data/db/data_migrations/upgrade/20111216192114_add_secured_models_to_menu_items.rb +18 -0
  112. data/db/data_migrations/upgrade/20111216202819_set_contents_iid_to_permalink_where_null.rb +12 -0
  113. data/db/migrate/20110211002317_setup_knitkit.rb +259 -0
  114. data/db/migrate/upgrade/20111014190442_update_contents.rb +25 -0
  115. data/db/migrate/upgrade/20111014201502_add_published_by_to_published_elements.rb +22 -0
  116. data/db/migrate/upgrade/20111017133851_add_iid_to_section.rb +21 -0
  117. data/db/migrate/upgrade/20111027145006_add_in_menu_to_section.rb +19 -0
  118. data/lib/knitkit.rb +12 -0
  119. data/lib/knitkit/engine.rb +26 -0
  120. data/lib/knitkit/extensions.rb +18 -0
  121. data/lib/knitkit/extensions/action_controller/theme_support/acts_as_themed_controller.rb +88 -0
  122. data/lib/knitkit/extensions/active_record/acts_as_commentable.rb +28 -0
  123. data/lib/knitkit/extensions/active_record/acts_as_publishable.rb +38 -0
  124. data/lib/knitkit/extensions/active_record/theme_support/has_many_themes.rb +34 -0
  125. data/lib/knitkit/extensions/compass/widgets/base.rb +53 -0
  126. data/lib/knitkit/extensions/core/array.rb +5 -0
  127. data/lib/knitkit/extensions/railties/action_view.rb +187 -0
  128. data/lib/knitkit/extensions/railties/theme_support/asset_tag_helper.rb +198 -0
  129. data/lib/knitkit/extensions/railties/theme_support/theme_file_resolver.rb +44 -0
  130. data/lib/knitkit/routing_filter/section_router.rb +55 -0
  131. data/lib/knitkit/syntax_validator.rb +32 -0
  132. data/lib/knitkit/version.rb +3 -0
  133. data/lib/tasks/knitkit_tasks.rake +4 -0
  134. data/public/images/knitkit/bullet.png +0 -0
  135. data/public/images/knitkit/content.png +0 -0
  136. data/public/images/knitkit/footer.png +0 -0
  137. data/public/images/knitkit/graphic.png +0 -0
  138. data/public/images/knitkit/greyFadeDown.png +0 -0
  139. data/public/images/knitkit/link.png +0 -0
  140. data/public/images/knitkit/logo.png +0 -0
  141. data/public/images/knitkit/menu.png +0 -0
  142. data/public/images/knitkit/menu_select.png +0 -0
  143. data/public/images/knitkit/search.png +0 -0
  144. data/public/javascripts/datepicker.js +440 -0
  145. data/public/javascripts/erp_app/desktop/applications/knitkit/articles_grid_panel.js +473 -0
  146. data/public/javascripts/erp_app/desktop/applications/knitkit/center_region.js +576 -0
  147. data/public/javascripts/erp_app/desktop/applications/knitkit/comments_grid_panel.js +217 -0
  148. data/public/javascripts/erp_app/desktop/applications/knitkit/east_region.js +26 -0
  149. data/public/javascripts/erp_app/desktop/applications/knitkit/file_assets_panel.js +109 -0
  150. data/public/javascripts/erp_app/desktop/applications/knitkit/image_assets_data_view.js +30 -0
  151. data/public/javascripts/erp_app/desktop/applications/knitkit/image_assets_panel.js +160 -0
  152. data/public/javascripts/erp_app/desktop/applications/knitkit/inquiries_grid_panel.js +46 -0
  153. data/public/javascripts/erp_app/desktop/applications/knitkit/module.js +46 -0
  154. data/public/javascripts/erp_app/desktop/applications/knitkit/publish_window.js +92 -0
  155. data/public/javascripts/erp_app/desktop/applications/knitkit/published_grid_panel.js +220 -0
  156. data/public/javascripts/erp_app/desktop/applications/knitkit/section_articles_grid_panel.js +613 -0
  157. data/public/javascripts/erp_app/desktop/applications/knitkit/themes_tree_panel.js +573 -0
  158. data/public/javascripts/erp_app/desktop/applications/knitkit/versions_grid_panel.js +664 -0
  159. data/public/javascripts/erp_app/desktop/applications/knitkit/west_region.js +2161 -0
  160. data/public/javascripts/erp_app/desktop/applications/knitkit/widgets_panel.js +52 -0
  161. data/public/stylesheets/datepicker.css +121 -0
  162. data/public/stylesheets/erp_app/desktop/applications/knitkit/knitkit.css +114 -0
  163. data/public/stylesheets/extjs/resources/css/knitkit_extjs_4.css +219 -0
  164. data/public/stylesheets/knitkit/style.css +394 -0
  165. metadata +289 -0
@@ -0,0 +1,31 @@
1
+ widgetTpl = new Ext.Template(
2
+ "<% #Optional Parameters:\n",
3
+ " # content_type: Leave blank to search all section types, set to Blog to only search Blog articles\n",
4
+ " # section_permalink: This is the permalink value for the section \n",
5
+ " # Useful if you only want to search articles within a single Blog section\n",
6
+ " # results_permalink: How do you want your results to display? via ajax? or on a new page?\n",
7
+ " # Leave blank if you want results to display via ajax on the same page as the search form\n",
8
+ " # Enter the permalink of results page if you want the search results to display on a new page\n",
9
+ " # per_page: Number of results per page \n",
10
+ " # class: CSS class for the form %>\n",
11
+ "<%= render_widget :search, \n",
12
+ " :action => get_widget_action,\n",
13
+ " :params => set_widget_params({\n",
14
+ " :content_type => '',\n",
15
+ " :section_permalink => '',\n",
16
+ " :results_permalink => '',\n",
17
+ " :per_page => 20,\n",
18
+ " :class => ''}) %>\n"
19
+ );
20
+
21
+ Compass.ErpApp.Widgets.Search = {
22
+ addSearch:function(){
23
+ Ext.getCmp('knitkitCenterRegion').addContentToActiveCodeMirror(widgetTpl.apply({}));
24
+ }
25
+ }
26
+
27
+ Compass.ErpApp.Widgets.AvailableWidgets.push({
28
+ name:'Search',
29
+ iconUrl:'/images/icons/search/search_48x48.png',
30
+ onClick:Compass.ErpApp.Widgets.Search.addSearch
31
+ });
@@ -0,0 +1,39 @@
1
+ <div>
2
+ <% if @ajax_results %>
3
+ <%= form_remote_tag build_widget_url(:new) do %>
4
+ <div class="form_settings">
5
+ <%= hidden_field_tag :section_permalink, @section_permalink %>
6
+ <%= hidden_field_tag :content_type, @content_type %>
7
+ <%= hidden_field_tag :per_page, @per_page %>
8
+ <p>
9
+ <span style="width:75px;">Search For</span>
10
+ <%= text_field_tag :query %>
11
+ </p>
12
+ <p style="padding-top: 15px">
13
+ <span style="width:75px">&nbsp;</span>
14
+ <%= submit_tag "Submit", :disable_with => "Please wait...", :class => "submit", :style => 'margin: 0 0 0 0px;' %>
15
+ </p>
16
+ <% end %>
17
+ </div>
18
+ <% else %>
19
+ <%= form_tag "/#{@results_permalink}", :method => :get, :html => {:class => @css_class} do %>
20
+ <div class="form_settings">
21
+ <%= hidden_field_tag :section_permalink, @section_permalink %>
22
+ <%= hidden_field_tag :results_permalink, @results_permalink %>
23
+ <%= hidden_field_tag :content_type, @content_type %>
24
+ <%= hidden_field_tag :widget_action, 'new' %>
25
+ <%= hidden_field_tag :per_page, @per_page %>
26
+ <p>
27
+ <span style="width:75px;">Search For</span>
28
+ <%= text_field_tag :query %>
29
+ </p>
30
+ <p style="padding-top: 15px">
31
+ <span style="width:75px">&nbsp;</span>
32
+ <%= submit_tag "Submit", :disable_with => "Please wait...", :class => "submit", :style => 'margin: 0 0 0 0px;' %>
33
+ </p>
34
+ <% end %>
35
+ </div>
36
+ <% end %>
37
+ </div>
38
+ <br />
39
+ <div id="<%=widget_result_id%>"></div>
@@ -0,0 +1,3 @@
1
+ <p>
2
+ <%=render :partial => '/search' %>
3
+ </p>
@@ -0,0 +1,24 @@
1
+ <h2><%=h @website_section.title %></h2>
2
+
3
+ <% @contents.each do |content| %>
4
+ <%=raw content.body_html %>
5
+ <% end %>
6
+
7
+ <% #Optional Parameters:
8
+ # content_type: Leave blank to search all section types, set to Blog to only search Blog articles
9
+ # section_permalink: This is the permalink value for the section
10
+ # Useful if you only want to search articles within a single Blog section
11
+ # results_permalink: How do you want your results to display? via ajax? or on a new page?
12
+ # Leave blank if you want results to display via ajax on the same page as the search form
13
+ # Enter the permalink of results page if you want the search results to display on a new page
14
+ # per_page: Number of results per page
15
+ # class: CSS class for the form %>
16
+ <%= render_widget :search,
17
+ :action => get_widget_action,
18
+ :params => set_widget_params({
19
+ :content_type => '',
20
+ :section_permalink => '',
21
+ :results_permalink => '',
22
+ :per_page => 20,
23
+ :class => ''
24
+ }) %>
@@ -0,0 +1,48 @@
1
+ <% unless @ajax_results %>
2
+ <p>
3
+ <%=render :partial => '/search' %>
4
+ </p>
5
+ <% end %>
6
+
7
+ <% @results.each do |r| %>
8
+ <p>
9
+ <a href="/<%=r[:link] %>"><%= r[:title] %></a><br />
10
+ <%= raw r[:content].body_html[0..100] unless r[:content].body_html.nil? %><br />
11
+ </p>
12
+ <% end %>
13
+
14
+ <% if @ajax_results %>
15
+ <p>
16
+ <%= will_paginate @results, :class => 'pagination ajax', :params => { :widget_name => 'search',
17
+ :widget_action => 'new',
18
+ :uuid => @uuid,
19
+ :query => params[:query],
20
+ :content_type => params[:content_type],
21
+ :section_permalink => params[:section_permalink],
22
+ :per_page => params[:per_page],
23
+ :only_path => true,
24
+ :use_route => :widget,
25
+ :scope => erp_app
26
+ } %>
27
+ </p>
28
+ <% else %>
29
+ <p>
30
+ <%= will_paginate @results, :params => { :section_id => WebsiteSection.find_by_permalink(@results_permalink).id,
31
+ :widget_action => 'new',
32
+ :query => params[:query],
33
+ :content_type => params[:content_type],
34
+ :section_permalink => params[:section_permalink],
35
+ :per_page => params[:per_page],
36
+ :only_path => true,
37
+ :use_route => :page,
38
+ :scope => main_app
39
+ } %>
40
+ </p>
41
+ <% end %>
42
+ <% if @ajax_results %>
43
+ <script type="text/javascript">
44
+ $(function(){
45
+ $('.pagination a').attr('data-remote', 'true');
46
+ });
47
+ </script>
48
+ <% end %>
@@ -0,0 +1,72 @@
1
+
2
+ module Widgets
3
+ module Signup
4
+ class Base < ErpApp::Widgets::Base
5
+ def index
6
+ @login_url = params[:login_url]
7
+ render
8
+ end
9
+
10
+ def new
11
+ @website = Website.find_by_host(request.host_with_port)
12
+ @email = params[:email]
13
+ @user = User.new(
14
+ :email => @email,
15
+ :username => params[:username],
16
+ :password => params[:password],
17
+ :password_confirmation => params[:password_confirmation]
18
+ )
19
+ #set this to tell activation where to redirect_to for login and temp password
20
+ @user.add_instance_attribute(:login_url,params[:login_url])
21
+ @user.add_instance_attribute(:temp_password, params[:password]);
22
+ begin
23
+ if @user.save
24
+ @user.roles << @website.role
25
+ individual = Individual.create(:current_first_name => params[:first_name], :current_last_name => params[:last_name])
26
+ @user.party = individual.party
27
+ @user.save
28
+ render :update => {:id => "#{@uuid}_result", :view => :success}
29
+ else
30
+ render :update => {:id => "#{@uuid}_result", :view => :error}
31
+ end
32
+ render :json => {:success => success, :message => message}
33
+ rescue Exception=>ex
34
+ logger.error ex.message
35
+ logger.error ex.backtrace
36
+ render :update => {:id => "#{@uuid}_result", :view => :error}
37
+ end
38
+ end
39
+
40
+ #should not be modified
41
+ #modify at your own risk
42
+ def locate
43
+ File.dirname(__FILE__)
44
+ end
45
+
46
+ class << self
47
+ def title
48
+ "Sign Up"
49
+ end
50
+
51
+ def views_location
52
+ File.join(File.dirname(__FILE__),"/views")
53
+ end
54
+
55
+ def widget_name
56
+ File.basename(File.dirname(__FILE__))
57
+ end
58
+
59
+ def base_layout
60
+ begin
61
+ file = File.join(File.dirname(__FILE__),"/views/layouts/base.html.erb")
62
+ IO.read(file)
63
+ rescue
64
+ return nil
65
+ end
66
+ end
67
+ end
68
+
69
+ end
70
+ end
71
+ end
72
+
@@ -0,0 +1,13 @@
1
+ Compass.ErpApp.Widgets.Signup = {
2
+ addSignup:function(){
3
+ Ext.getCmp('knitkitCenterRegion').addContentToActiveCodeMirror('<%= render_widget :signup, :params => {:login_url => "/login"}%>');
4
+ }
5
+ }
6
+
7
+ Compass.ErpApp.Widgets.AvailableWidgets.push({
8
+ name:'Signup',
9
+ iconUrl:'/images/icons/user/user_48x48.png',
10
+ onClick:Compass.ErpApp.Widgets.Signup.addSignup
11
+ });
12
+
13
+
@@ -0,0 +1,36 @@
1
+ <div id="<%=widget_result_id%>"></div>
2
+ <div>
3
+ <%= form_remote_tag build_widget_url(:new) do %>
4
+ <div class="form_settings">
5
+ <p>
6
+ <span>First Name</span>
7
+ <%= text_field_tag :first_name %>
8
+ </p>
9
+ <p>
10
+ <span>Last Name</span>
11
+ <%= text_field_tag :last_name %>
12
+ </p>
13
+ <p>
14
+ <span>Email</span>
15
+ <%= text_field_tag :email %>
16
+ </p>
17
+ <p>
18
+ <span>Username</span>
19
+ <%= text_field_tag :username %>
20
+ </p>
21
+ <p>
22
+ <span>Password</span>
23
+ <%= password_field_tag :password %>
24
+ </p>
25
+ <p>
26
+ <span>Confirm Password</span>
27
+ <%= password_field_tag :password_confirmation %>
28
+ </p>
29
+ <p style="padding-top: 15px">
30
+ <span>&nbsp;</span>
31
+ <%= submit_tag "Sign Up", :disable_with => "Please wait...", :class => "submit", :style => 'margin: 0 0 0 0px;' %>
32
+ </p>
33
+ </div>
34
+ <input type="hidden" value="<%=@login_url%>" name="login_url" />
35
+ <% end %>
36
+ </div>
@@ -0,0 +1,11 @@
1
+ <div class="sexyerror">
2
+ <h2>There was an error.</h2>
3
+ <%if !@user.errors.empty?%>
4
+ <h3>Please address the following issues</h3>
5
+ <ul>
6
+ <% @user.errors.full_messages.each do |msg| %>
7
+ <li><%=msg%></li>
8
+ <% end %>
9
+ </ul>
10
+ <%end%>
11
+ </div>
@@ -0,0 +1 @@
1
+ <%= render :partial => '/signup_form'%>
@@ -0,0 +1,7 @@
1
+ <h2><%=h @website_section.title %></h2>
2
+
3
+ <% @contents.each do |content| %>
4
+ <%=content.body_html %>
5
+ <% end %>
6
+
7
+ <%= render_widget :signup, :params => {:login_url => "/login"}%>
@@ -0,0 +1,4 @@
1
+ <div class="sexynotice">
2
+ <h1>Sign up Successful.</h1>
3
+ <p>You will receive an email at <%=@email%> to activate your account.</p>
4
+ </div>
File without changes
data/config/routes.rb ADDED
@@ -0,0 +1,41 @@
1
+ Rails.application.routes.draw do
2
+ filter :section_router
3
+
4
+ get 'pages/:section_id' => 'knitkit/website_sections#index', :as => 'page'
5
+ get 'pages/:section_id/:id' => 'knitkit/articles#show', :as => 'page_article'
6
+ get 'blogs/:section_id(.:format)' => 'knitkit/blogs#index', :as => 'blogs'
7
+ get 'blogs/:section_id/:id' => 'knitkit/blogs#show', :as => 'blog_article'
8
+ get 'blogs/:section_id/tag/:tag_id(.:format)' => 'knitkit/blogs#tag', :as => 'blog_tag'
9
+
10
+ match '/comments/add/:section_id/:content_id' => 'knitkit/comments#add', :as => 'comments'
11
+ match '/unauthorized' => 'unauthorized#index', :as => 'knitkit/unauthorized'
12
+ match '/view_current_publication' => 'knitkit/base#view_current_publication'
13
+ end
14
+
15
+ Knitkit::Engine.routes.draw do
16
+ #Desktop Applications
17
+ #knitkit
18
+ match '/erp_app/desktop/:action' => 'erp_app/desktop/app'
19
+ match '/erp_app/desktop/image_assets/:context/:action' => 'erp_app/desktop/image_assets'
20
+ match '/erp_app/desktop/file_assets/:context/:action' => 'erp_app/desktop/file_assets'
21
+ #article
22
+ match '/erp_app/desktop/articles/:action(/:section_id)' => 'erp_app/desktop/articles'
23
+ #content
24
+ match '/erp_app/desktop/content/:action' => 'erp_app/desktop/content'
25
+ #website
26
+ match '/erp_app/desktop/site(/:action)' => 'erp_app/desktop/website'
27
+ #section
28
+ match '/erp_app/desktop/section/:action' => 'erp_app/desktop/website_section'
29
+ #theme
30
+ match '/erp_app/desktop/theme/:action' => 'erp_app/desktop/theme'
31
+ #versions
32
+ match '/erp_app/desktop/versions/:action' => 'erp_app/desktop/versions'
33
+ #comments
34
+ match '/erp_app/desktop/comments/:action(/:content_id)' => 'erp_app/desktop/comments'
35
+ #inquiries
36
+ match '/erp_app/desktop/inquiries/:action(/:website_id)' => 'erp_app/desktop/inquiries'
37
+ #website_nav
38
+ match '/erp_app/desktop/website_nav/:action' => 'erp_app/desktop/website_nav'
39
+ #position
40
+ match '/erp_app/desktop/position/:action' => 'erp_app/desktop/position'
41
+ end
@@ -0,0 +1,11 @@
1
+ class AddPublisherRole
2
+
3
+ def self.up
4
+ Role.create(:internal_identifier => 'publisher', :description => 'Publisher')
5
+ end
6
+
7
+ def self.down
8
+ Role.iid('publisher').destroy
9
+ end
10
+
11
+ end
@@ -0,0 +1,31 @@
1
+ class AddKnitkitApplication
2
+
3
+ def self.up
4
+ if DesktopApplication.find_by_internal_identifier('knitkit').nil?
5
+ knikit_app = DesktopApplication.create(
6
+ :description => 'KnitKit',
7
+ :icon => 'icon-palette',
8
+ :javascript_class_name => 'Compass.ErpApp.Desktop.Applications.Knitkit',
9
+ :internal_identifier => 'knitkit',
10
+ :shortcut_id => 'knitkit-win'
11
+ )
12
+
13
+ knikit_app.preference_types << PreferenceType.iid('desktop_shortcut')
14
+ knikit_app.preference_types << PreferenceType.iid('autoload_application')
15
+ knikit_app.save
16
+
17
+ admin_user = User.find_by_username('admin')
18
+ admin_user.desktop.applications << knikit_app
19
+ admin_user.save
20
+
21
+ truenorth_user = User.find_by_username('truenorth')
22
+ truenorth_user.desktop.applications << knikit_app
23
+ truenorth_user.save
24
+ end
25
+ end
26
+
27
+ def self.down
28
+ DesktopApplication.find_by_internal_identifier('knitkit').destroy
29
+ end
30
+
31
+ end
@@ -0,0 +1,13 @@
1
+ class CreatePathsForSections
2
+
3
+ def self.up
4
+ WebsiteSection.all.each do |section|
5
+ section.update_path!
6
+ end
7
+ end
8
+
9
+ def self.down
10
+ #remove data here
11
+ end
12
+
13
+ end
@@ -0,0 +1,18 @@
1
+ class AddSecuredModelsToMenuItems
2
+
3
+ def self.up
4
+ WebsiteNavItem.all.each do |nav_item|
5
+ if nav_item.secured_model.nil?
6
+ secured_model = SecuredModel.new
7
+ nav_item.secured_model = secured_model
8
+ secured_model.secured_record = nav_item
9
+ nav_item.save
10
+ end
11
+ end
12
+ end
13
+
14
+ def self.down
15
+ #remove data here
16
+ end
17
+
18
+ end
@@ -0,0 +1,12 @@
1
+ class SetContentsIidToPermalinkWhereNull < ActiveRecord::Migration
2
+
3
+ def self.up
4
+ #insert data here
5
+ execute "UPDATE contents SET internal_identifier=permalink WHERE internal_identifier IS NULL"
6
+ end
7
+
8
+ def self.down
9
+ #remove data here
10
+ end
11
+
12
+ end