knitkit 3.0.0 → 3.2.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (203) hide show
  1. checksums.yaml +4 -4
  2. data/{public → app/assets}/images/check.png +0 -0
  3. data/{public → app/assets}/images/credit_card.png +0 -0
  4. data/{public → app/assets}/images/inline_edit/close.png +0 -0
  5. data/{public → app/assets}/images/knitkit/icons/document.png +0 -0
  6. data/{public → app/assets}/images/knitkit/icons/multi_doc.png +0 -0
  7. data/{public → app/assets}/images/knitkit/logo.png +0 -0
  8. data/{public → app/assets}/images/knitkit/splash/images/add-site.png +0 -0
  9. data/app/assets/images/knitkit/splash/images/add_website_105x105-active.png +0 -0
  10. data/app/assets/images/knitkit/splash/images/add_website_105x105.png +0 -0
  11. data/{public → app/assets}/images/knitkit/splash/images/adjust-site.png +0 -0
  12. data/{public → app/assets}/images/knitkit/splash/images/browse-site.png +0 -0
  13. data/app/assets/images/knitkit/splash/images/browse_db_105x105-active.png +0 -0
  14. data/app/assets/images/knitkit/splash/images/browse_db_105x105.png +0 -0
  15. data/app/assets/images/knitkit/splash/images/console_105x105-active.png +0 -0
  16. data/app/assets/images/knitkit/splash/images/console_105x105.png +0 -0
  17. data/{public → app/assets}/images/knitkit/splash/images/find-themes.png +0 -0
  18. data/app/assets/images/knitkit/splash/images/find_themes_105x105-active.png +0 -0
  19. data/app/assets/images/knitkit/splash/images/find_themes_105x105.png +0 -0
  20. data/app/assets/images/knitkit/splash/images/learn_more_105x105-active.png +0 -0
  21. data/app/assets/images/knitkit/splash/images/learn_more_105x105.png +0 -0
  22. data/{public → app/assets}/images/knitkit/splash/images/settings.png +0 -0
  23. data/{public → app/assets}/images/knitkit/splash/images/tutorials.png +0 -0
  24. data/app/assets/images/knitkit/splash/splash.png +0 -0
  25. data/app/assets/images/widgets/manage_profile/contact_information.png +0 -0
  26. data/app/assets/images/widgets/manage_profile/password.png +0 -0
  27. data/app/assets/images/widgets/manage_profile/user_information.png +0 -0
  28. data/app/assets/javascripts/erp_app/desktop/applications/knitkit/app.js +24 -0
  29. data/{public → app/assets}/javascripts/erp_app/desktop/applications/knitkit/articles_grid_panel.js +15 -12
  30. data/{public → app/assets}/javascripts/erp_app/desktop/applications/knitkit/center_region.js +69 -48
  31. data/app/assets/javascripts/erp_app/desktop/applications/knitkit/comments_grid_panel.js +214 -0
  32. data/{public → app/assets}/javascripts/erp_app/desktop/applications/knitkit/east_region/east_region.js +0 -0
  33. data/{public → app/assets}/javascripts/erp_app/desktop/applications/knitkit/east_region/file_assets_panel.js +17 -19
  34. data/{public → app/assets}/javascripts/erp_app/desktop/applications/knitkit/east_region/image_assets_data_view.js +13 -3
  35. data/{public → app/assets}/javascripts/erp_app/desktop/applications/knitkit/east_region/image_assets_panel.js +59 -48
  36. data/{public → app/assets}/javascripts/erp_app/desktop/applications/knitkit/east_region/widgets_panel.js +0 -0
  37. data/{public → app/assets}/javascripts/erp_app/desktop/applications/knitkit/inquiries_grid_panel.js +2 -2
  38. data/{public → app/assets}/javascripts/erp_app/desktop/applications/knitkit/module.js +2 -2
  39. data/{public → app/assets}/javascripts/erp_app/desktop/applications/knitkit/publish_window.js +0 -0
  40. data/{public → app/assets}/javascripts/erp_app/desktop/applications/knitkit/published_grid_panel.js +1 -1
  41. data/app/assets/javascripts/erp_app/desktop/applications/knitkit/splash_screen.js +268 -0
  42. data/{public → app/assets}/javascripts/erp_app/desktop/applications/knitkit/top_menu/main_menu.js +85 -33
  43. data/{public → app/assets}/javascripts/erp_app/desktop/applications/knitkit/top_menu/websites_combo.js +0 -0
  44. data/{public → app/assets}/javascripts/erp_app/desktop/applications/knitkit/versions_grid_panel.js +5 -28
  45. data/{public → app/assets}/javascripts/erp_app/desktop/applications/knitkit/west_region/helpers/article.js +22 -8
  46. data/{public → app/assets}/javascripts/erp_app/desktop/applications/knitkit/west_region/helpers/document.js +143 -25
  47. data/{public → app/assets}/javascripts/erp_app/desktop/applications/knitkit/west_region/helpers/host.js +5 -1
  48. data/{public → app/assets}/javascripts/erp_app/desktop/applications/knitkit/west_region/helpers/menu.js +2 -0
  49. data/{public → app/assets}/javascripts/erp_app/desktop/applications/knitkit/west_region/helpers/section.js +181 -65
  50. data/{public → app/assets}/javascripts/erp_app/desktop/applications/knitkit/west_region/helpers/website_nav_items.js +0 -0
  51. data/{public → app/assets}/javascripts/erp_app/desktop/applications/knitkit/west_region/hosts_tree_panel.js +0 -0
  52. data/{public → app/assets}/javascripts/erp_app/desktop/applications/knitkit/west_region/menu_tree_panel.js +0 -0
  53. data/{public → app/assets}/javascripts/erp_app/desktop/applications/knitkit/west_region/site_contents_tree_panel.js +121 -116
  54. data/{public → app/assets}/javascripts/erp_app/desktop/applications/knitkit/west_region/themes_tree_panel.js +101 -10
  55. data/{public → app/assets}/javascripts/erp_app/desktop/applications/knitkit/west_region/west_region.js +9 -5
  56. data/app/assets/javascripts/knitkit-web.js +22 -0
  57. data/app/assets/javascripts/knitkit/additional-methods.min.js +4 -0
  58. data/app/assets/javascripts/knitkit/bootstrap.min.js +7 -0
  59. data/app/assets/javascripts/knitkit/captcha.js +154 -0
  60. data/{public → app/assets}/javascripts/knitkit/confirm-bootstrap.js +1 -1
  61. data/{public → app/assets}/javascripts/knitkit/inline_editing.js +1 -1
  62. data/{public → app/assets}/javascripts/knitkit/jquery.maskedinput.min.js +0 -0
  63. data/app/assets/javascripts/knitkit/jquery.validate.min.js +4 -0
  64. data/app/assets/javascripts/knitkit/js.cookie.js +145 -0
  65. data/{public → app/assets}/javascripts/knitkit/theme.js +0 -0
  66. data/app/assets/stylesheets/erp_app/desktop/applications/knitkit/app.css +12 -0
  67. data/{public → app/assets}/stylesheets/erp_app/desktop/applications/knitkit/knitkit.css +23 -33
  68. data/app/assets/stylesheets/erp_app/shared/knitkit_shared.css +21 -0
  69. data/app/assets/stylesheets/fonts/glyphicons-halflings-regular.eot +0 -0
  70. data/app/assets/stylesheets/fonts/glyphicons-halflings-regular.svg +288 -0
  71. data/app/assets/stylesheets/fonts/glyphicons-halflings-regular.ttf +0 -0
  72. data/app/assets/stylesheets/fonts/glyphicons-halflings-regular.woff +0 -0
  73. data/app/assets/stylesheets/fonts/glyphicons-halflings-regular.woff2 +0 -0
  74. data/app/assets/stylesheets/knitkit-web.css +16 -0
  75. data/app/assets/stylesheets/knitkit/bootstrap.min.css +5 -0
  76. data/app/assets/stylesheets/knitkit/captcha.css +59 -0
  77. data/app/assets/stylesheets/knitkit/custom.css +144 -0
  78. data/{public → app/assets}/stylesheets/knitkit/inline_editing.css +0 -0
  79. data/app/assets/stylesheets/knitkit/submenu.css +93 -0
  80. data/app/controllers/api/v1/websites_controller.rb +14 -0
  81. data/app/controllers/captcha_controller.rb +53 -0
  82. data/app/controllers/knitkit/base_controller.rb +1 -5
  83. data/app/controllers/knitkit/erp_app/desktop/app_controller.rb +2 -9
  84. data/app/controllers/knitkit/erp_app/desktop/articles_controller.rb +20 -7
  85. data/app/controllers/knitkit/erp_app/desktop/file_assets_controller.rb +38 -28
  86. data/app/controllers/knitkit/erp_app/desktop/image_assets_controller.rb +16 -9
  87. data/app/controllers/knitkit/erp_app/desktop/online_document_sections_controller.rb +69 -15
  88. data/app/controllers/knitkit/erp_app/desktop/position_controller.rb +45 -58
  89. data/app/controllers/knitkit/erp_app/desktop/theme_controller.rb +64 -29
  90. data/app/controllers/knitkit/erp_app/desktop/website_controller.rb +36 -13
  91. data/app/controllers/knitkit/erp_app/desktop/website_host_controller.rb +12 -0
  92. data/app/controllers/knitkit/erp_app/desktop/website_nav_controller.rb +4 -11
  93. data/app/controllers/knitkit/erp_app/desktop/website_nav_item_controller.rb +2 -9
  94. data/app/controllers/knitkit/erp_app/desktop/website_section_controller.rb +56 -20
  95. data/app/controllers/knitkit/online_document_sections_controller.rb +9 -3
  96. data/app/mailers/website_inquiry_mailer.rb +11 -3
  97. data/app/models/content.rb +16 -6
  98. data/app/models/documented_item.rb +12 -1
  99. data/app/models/online_document_section.rb +54 -20
  100. data/app/models/published_website.rb +16 -0
  101. data/app/models/theme.rb +53 -47
  102. data/app/models/website.rb +172 -191
  103. data/app/models/website_section.rb +64 -30
  104. data/app/views/knitkit/blogs/show.html.erb +5 -2
  105. data/app/views/layouts/knitkit/base.html.erb +54 -51
  106. data/app/views/menus/knitkit/_default_menu.html.erb +11 -11
  107. data/app/views/menus/knitkit/_default_section_menu.html.erb +2 -2
  108. data/app/views/menus/knitkit/_default_sub_menu.erb +27 -0
  109. data/app/views/menus/knitkit/_default_sub_section_menu.html.erb +30 -0
  110. data/app/views/website_inquiry_mailer/inquiry.html.erb +266 -0
  111. data/app/widgets/contact_us/base.rb +26 -16
  112. data/app/widgets/contact_us/javascript/contact_us.js +1 -1
  113. data/app/widgets/contact_us/views/error.html.erb +7 -3
  114. data/app/widgets/contact_us/views/index.html.erb +36 -28
  115. data/app/widgets/google_map/javascript/google_map.js +1 -1
  116. data/app/widgets/google_map/views/index.html.erb +1 -1
  117. data/app/widgets/login/javascript/login.js +1 -1
  118. data/app/widgets/login/views/index.html.erb +1 -1
  119. data/app/widgets/manage_profile/base.rb +141 -112
  120. data/app/widgets/manage_profile/javascript/manage_profile.js +2 -2
  121. data/app/widgets/manage_profile/views/_password_form.html.erb +1 -1
  122. data/app/widgets/manage_profile/views/_user_information_form.html.erb +1 -30
  123. data/app/widgets/manage_profile/views/index.html.erb +42 -40
  124. data/app/widgets/reset_password/base.rb +39 -8
  125. data/app/widgets/reset_password/javascript/reset_password.js +1 -1
  126. data/app/widgets/reset_password/views/index.html.erb +3 -3
  127. data/app/widgets/reset_password/views/invalid_reset_token.html.erb +7 -0
  128. data/app/widgets/reset_password/views/layouts/base.html.erb +1 -1
  129. data/app/widgets/reset_password/views/reset_password.html.erb +39 -0
  130. data/app/widgets/reset_password/views/reset_success.html.erb +5 -0
  131. data/app/widgets/search/base.rb +5 -5
  132. data/app/widgets/search/javascript/search.js +6 -6
  133. data/app/widgets/search/views/_inline_search_form.html.erb +23 -12
  134. data/app/widgets/search/views/_search_form.html.erb +34 -30
  135. data/app/widgets/search/views/layouts/base.html.erb +6 -1
  136. data/app/widgets/signup/base.rb +73 -30
  137. data/app/widgets/signup/javascript/signup.js +1 -1
  138. data/app/widgets/signup/views/_signup_form.html.erb +2 -1
  139. data/app/widgets/signup/views/layouts/base.html.erb +1 -1
  140. data/app/widgets/signup/views/success.html.erb +2 -3
  141. data/config/routes.rb +25 -4
  142. data/db/data_migrations/20110509223702_add_publisher_role.rb +0 -2
  143. data/db/data_migrations/20110816153456_add_knitkit_application.rb +7 -15
  144. data/db/data_migrations/20120127150505_create_website_default_configuration.rb +63 -3
  145. data/db/data_migrations/20150118180450_add_website_member_roles.rb +12 -0
  146. data/db/data_migrations/20150414150359_nest_knitkit_security_roles.rb +35 -0
  147. data/db/data_migrations/20150414173437_move_website_roles_under_website_builder.rb +19 -0
  148. data/db/migrate/20110211002317_setup_knitkit.rb +86 -39
  149. data/lib/knitkit.rb +8 -2
  150. data/lib/knitkit/config.rb +2 -3
  151. data/lib/knitkit/engine.rb +35 -4
  152. data/lib/knitkit/extensions.rb +2 -1
  153. data/lib/knitkit/extensions/action_controller/theme_support/acts_as_themed_controller.rb +1 -1
  154. data/lib/knitkit/extensions/action_mailer/theme_support/acts_as_themed_mailer.rb +1 -1
  155. data/lib/knitkit/extensions/compass_ae/mailers/user_mailer.rb +31 -0
  156. data/lib/knitkit/extensions/compass_ae/widgets/base.rb +1 -1
  157. data/lib/knitkit/extensions/railties/action_controller/captcha_helper.rb +43 -0
  158. data/lib/knitkit/extensions/railties/action_view/helpers/content_helper.rb +1 -1
  159. data/lib/knitkit/extensions/railties/action_view/helpers/menu_helper.rb +11 -1
  160. data/lib/knitkit/extensions/railties/theme_support/asset_tag_helper.rb +83 -0
  161. data/lib/knitkit/routing_filter/section_router.rb +24 -14
  162. data/lib/knitkit/version.rb +1 -1
  163. data/lib/tasks/knitkit_tasks.rake +89 -4
  164. data/lib/tasks/theme_parser.rake +85 -0
  165. data/public/fonts/glyphicons-halflings-regular.eot +0 -0
  166. data/public/fonts/glyphicons-halflings-regular.svg +288 -0
  167. data/public/fonts/glyphicons-halflings-regular.ttf +0 -0
  168. data/public/fonts/glyphicons-halflings-regular.woff +0 -0
  169. data/public/fonts/glyphicons-halflings-regular.woff2 +0 -0
  170. data/public/paypal-button.min.js +7 -0
  171. metadata +161 -82
  172. data/app/assets/javascripts/knitkit/application.js +0 -9
  173. data/app/assets/stylesheets/knitkit/application.css +0 -7
  174. data/app/mailers/document_mailer.rb +0 -10
  175. data/app/views/document_mailer/email_document.html.erb +0 -12
  176. data/app/views/knitkit/mobile/index.html.erb +0 -162
  177. data/app/views/knitkit/online_document_sections/index.html.erb +0 -279
  178. data/app/views/layouts/knitkit/online_document_sections.html.erb +0 -80
  179. data/app/views/website_inquiry_mailer/inquiry.erb +0 -24
  180. data/db/data_migrations/20120127150506_add_primary_host_to_website_configuration.rb +0 -33
  181. data/db/data_migrations/20120316150424_add_is_template_to_default_website_config.rb +0 -16
  182. data/db/data_migrations/20120809020508_update_website_and_configuration.rb +0 -82
  183. data/db/data_migrations/20121129185611_upgrade_website_role_iid.rb +0 -20
  184. data/db/migrate/20130405184234_add_use_markdown_to_section.rb +0 -19
  185. data/db/migrate/20131112013052_add_knitkit_missing_indexes.rb +0 -33
  186. data/db/migrate/20140622212723_update_website_inquiries.rb +0 -22
  187. data/db/migrate/20140911185022_add_publishing_to_website.rb +0 -5
  188. data/db/migrate/20141013073349_add_custom_fields_to_documents.rb +0 -12
  189. data/db/migrate/20141016101936_upgrade_remove_dynamic_attributes.rb +0 -13
  190. data/lib/knitkit/extensions/railties/theme_support/theme_file_resolver.rb +0 -49
  191. data/public/images/knitkit/close_window.png +0 -0
  192. data/public/images/knitkit/splash/splash.png +0 -0
  193. data/public/javascripts/erp_app/desktop/applications/knitkit/comments_grid_panel.js +0 -215
  194. data/public/javascripts/erp_app/desktop/applications/knitkit/select_roles_window.js +0 -108
  195. data/public/javascripts/erp_app/desktop/applications/knitkit/splash_screen.js +0 -170
  196. data/public/javascripts/knitkit/bootstrap-datepicker.js +0 -474
  197. data/public/javascripts/knitkit/bootstrap.min.js +0 -7
  198. data/public/javascripts/knitkit/mobile/app/view/Main.js +0 -108
  199. data/public/javascripts/knitkit/mobile/ux/slidenavigation/View.js +0 -734
  200. data/public/stylesheets/knitkit/bootstrap-responsive.min.css +0 -10
  201. data/public/stylesheets/knitkit/bootstrap.min.css +0 -7
  202. data/public/stylesheets/knitkit/custom.css +0 -122
  203. data/public/stylesheets/knitkit/datepicker.css +0 -182
@@ -8,7 +8,7 @@ Compass.ErpApp.Widgets.ManageProfile = {
8
8
 
9
9
  Compass.ErpApp.Widgets.AvailableWidgets.push({
10
10
  name:'Manage Profile',
11
- iconUrl:'/images/icons/document_edit/document_edit_48x48.png',
11
+ iconUrl:'/assets/icons/manage_profile/manage_profile_48x48.png',
12
12
  onClick:Compass.ErpApp.Widgets.ManageProfile.addManageProfile,
13
- about:'This widget allows users to manger thier user information, password and contact information.'
13
+ about:'This widget allows users to manage their user information, password and contact information.'
14
14
  });
@@ -6,7 +6,7 @@
6
6
  <div class="form-group">
7
7
  <label for="new_password">New Password</label>
8
8
  <%= password_field_tag :new_password, '', :class => 'form-control', :required => true %>
9
- <span>Password must be at least 8 characters long and start and end with a letter</span>
9
+ <span>Password must be between 8 and 20 characters with no spaces</span>
10
10
  </div>
11
11
  <div class="form-group">
12
12
  <label for="password_confirmation">Confirm Password</label>
@@ -15,36 +15,7 @@
15
15
  <label for="middle_name">Middle Name</label>
16
16
  <%= text_field_tag :middle_name, @individual.current_middle_name, :class => 'form-control' %>
17
17
  </div>
18
- <div class="form-group">
19
- <label for="birth_date">Date of Birth</label>
20
- <%= text_field_tag :birth_date,
21
- (@individual.birth_date.nil? ? Date.today.strftime('%m/%d/%Y') : @individual.birth_date.strftime('%m/%d/%Y')),
22
- :class => 'form-control',
23
- :required => true %>
24
- </div>
25
- <div class="form-group">
26
- <label>Gender</label>
27
- <br/>
28
- <div class="radio-inline">
29
- <label>
30
- <input type="radio" name="gender" id="male" <%= if @individual.gender == 'm' then 'checked=true' end %> value="m">
31
- Male
32
- </label>
33
- </div>
34
- <div class="radio-inline">
35
- <label>
36
- <input type="radio" name="gender" id="female" <%= if @individual.gender == 'f' then 'checked=true' end %> value="f">
37
- Female
38
- </label>
39
- </div>
40
- </div>
41
18
  <div class="form-group">
42
19
  <%= submit_tag "Submit", :disable_with => "Please wait...", :class => "btn btn-lg btn-primary btn-block" %>
43
20
  </div>
44
- <% end %>
45
-
46
- <script type="text/javascript">
47
- jQuery('#birth_date').datepicker({
48
- format: 'mm/dd/yyyy'
49
- });
50
- </script>
21
+ <% end %>
@@ -1,51 +1,53 @@
1
- <div id="<%= widget_result_id %>">
2
- <% if @message %>
1
+ <div class="manage-profile-widget">
2
+ <div id="<%= widget_result_id %>">
3
+ <% if @message %>
3
4
  <div class="alert alert-success">
4
5
  <%= @message %>
5
6
  </div>
6
- <% end %>
7
- </div>
7
+ <% end %>
8
+ </div>
8
9
 
9
- <div class="panel-group" id="accordion">
10
- <div class="panel panel-default">
11
- <div class="panel-heading">
12
- <h4 class="panel-title">
13
- <a data-toggle="collapse" data-parent="#accordion" href="#userInformation">
14
- User Information
15
- </a>
16
- </h4>
17
- </div>
18
- <div id="userInformation" class="panel-collapse collapse in">
19
- <div class="panel-body">
20
- <%= render :partial => '/user_information_form' %>
10
+ <div class="panel-group" id="accordion">
11
+ <div class="panel panel-default">
12
+ <div class="panel-heading">
13
+ <h4 class="panel-title">
14
+ <a data-toggle="collapse" data-parent="#accordion" href="#userInformation">
15
+ <img style="padding-right:10px;" src="/assets/widgets/manage_profile/user_information.png"><span>User Information</span>
16
+ </a>
17
+ </h4>
21
18
  </div>
22
- </div>
23
- </div>
24
- <div class="panel panel-default">
25
- <div class="panel-heading">
26
- <h4 class="panel-title">
27
- <a data-toggle="collapse" data-parent="#accordion" href="#password">
28
- Password
29
- </a>
30
- </h4>
31
- </div>
32
- <div id="password" class="panel-collapse collapse">
33
- <div class="panel-body">
34
- <%= render :partial => '/password_form' %>
19
+ <div id="userInformation" class="panel-collapse collapse in">
20
+ <div class="panel-body">
21
+ <%= render :partial => '/user_information_form' %>
22
+ </div>
35
23
  </div>
36
24
  </div>
37
- </div>
38
- <div class="panel panel-default">
39
- <div class="panel-heading">
40
- <h4 class="panel-title">
41
- <a data-toggle="collapse" data-parent="#accordion" href="#contactInformation">
42
- Contact Information
43
- </a>
44
- </h4>
25
+ <div class="panel panel-default">
26
+ <div class="panel-heading">
27
+ <h4 class="panel-title">
28
+ <a data-toggle="collapse" data-parent="#accordion" href="#password">
29
+ <img style="padding-right:10px;" src="/assets/widgets/manage_profile/password.png"><span>Password</span>
30
+ </a>
31
+ </h4>
32
+ </div>
33
+ <div id="password" class="panel-collapse collapse">
34
+ <div class="panel-body">
35
+ <%= render :partial => '/password_form' %>
36
+ </div>
37
+ </div>
45
38
  </div>
46
- <div id="contactInformation" class="panel-collapse collapse">
47
- <div class="panel-body">
48
- <%= render :partial => '/contact_information_form' %>
39
+ <div class="panel panel-default">
40
+ <div class="panel-heading">
41
+ <h4 class="panel-title">
42
+ <a data-toggle="collapse" data-parent="#accordion" href="#contactInformation">
43
+ <img style="padding-right:10px;" src="/assets/widgets/manage_profile/contact_information.png"><span>Contact Information</span>
44
+ </a>
45
+ </h4>
46
+ </div>
47
+ <div id="contactInformation" class="panel-collapse collapse">
48
+ <div class="panel-body">
49
+ <%= render :partial => '/contact_information_form' %>
50
+ </div>
49
51
  </div>
50
52
  </div>
51
53
  </div>
@@ -3,11 +3,41 @@ module Widgets
3
3
  class Base < ErpApp::Widgets::Base
4
4
 
5
5
  def index
6
- @website = Website.find_by_host(request.host_with_port)
7
- @login_url = params[:login_url]
8
- @domain = @website.configurations.first.get_item(ConfigurationItemType.find_by_internal_identifier('primary_host')).options.first.value
6
+ @website = Website.find_by_host(request.host_with_port)
7
+ @reset_password_url = params[:reset_password_url] || '/reset-password'
8
+ @domain = @website.configurations.first.get_item(ConfigurationItemType.find_by_internal_identifier('primary_host')).options.first.value
9
9
 
10
- render
10
+ if params[:token].present?
11
+ @token = params[:token].strip
12
+ @user = User.load_from_reset_password_token(params[:token])
13
+
14
+ if @user.blank?
15
+ render view: :invalid_reset_token
16
+ else
17
+ render view: :reset_password
18
+ end
19
+ else
20
+ render
21
+ end
22
+ end
23
+
24
+ def update_password
25
+ @login_url = params[:login_url].blank? ? '/login' : params[:login_url]
26
+ @token = params[:token].present? ? params[:token].strip : nil
27
+ @user = User.load_from_reset_password_token(@token)
28
+
29
+ if @user.blank?
30
+ render :update => {:id => "#{@uuid}_result", :view => :invalid_reset_token}
31
+ else
32
+ # the next line makes the password confirmation validation work
33
+ @user.password_confirmation = params[:password_confirmation].strip
34
+ # the next line clears the temporary token and updates the password
35
+ if @user.change_password!(params[:password].strip)
36
+ render :update => {:id => "#{@uuid}_result", :view => :reset_success}
37
+ else
38
+ render :update => {:id => "#{@uuid}_result", :view => :reset_password}
39
+ end
40
+ end
11
41
  end
12
42
 
13
43
  #should not be modified
@@ -27,14 +57,15 @@ module Widgets
27
57
 
28
58
  def base_layout
29
59
  begin
30
- file = File.join(File.dirname(__FILE__),"/views/layouts/base.html.erb")
60
+ file = File.join(File.dirname(__FILE__), "/views/layouts/base.html.erb")
31
61
  IO.read(file)
32
62
  rescue
33
63
  return nil
34
64
  end
35
65
  end
36
66
  end
37
- end
38
- end
39
- end
67
+
68
+ end # Base
69
+ end # ResetPassword
70
+ end # Widgets
40
71
 
@@ -8,7 +8,7 @@ Compass.ErpApp.Widgets.ResetPassword = {
8
8
 
9
9
  Compass.ErpApp.Widgets.AvailableWidgets.push({
10
10
  name:'Reset Password',
11
- iconUrl:'/images/icons/edit/edit_48x48.png',
11
+ iconUrl:'/assets/icons/reset_password/reset_password_48x48.png',
12
12
  onClick:Compass.ErpApp.Widgets.ResetPassword.addResetPassword,
13
13
  about:"This widget creates a form to submit for a user's password to be reset."
14
14
  });
@@ -1,5 +1,5 @@
1
- <div style="width:500px;" id="<%= widget_result_id %>"></div>
2
- <%= form_tag '/users/reset_password', :remote => true, :id => 'reset_password_form', :class => "form-signin", :style => 'max-width: 500px;' do %>
1
+ <div id="<%= widget_result_id %>"></div>
2
+ <%= form_tag '/users/reset_password', :remote => true, :id => 'reset_password_form', :class => "form-signin" do %>
3
3
  <input name="login" type="text" class="form-control" placeholder="Username / Email Address" required autofocus>
4
4
  <br/>
5
5
 
@@ -7,7 +7,7 @@
7
7
  <button class="btn btn-lg btn-primary btn-block" type="submit">Submit</button>
8
8
  <%= link_to 'Cancel', 'home' %>
9
9
  </p>
10
- <input type="hidden" name="login_url" value="<%= @login_url %>"/>
10
+ <input type="hidden" name="reset_password_url" value="<%= @reset_password_url %>"/>
11
11
  <input type="hidden" name="domain" value="<%= @domain %>"/>
12
12
  <% end %>
13
13
 
@@ -0,0 +1,7 @@
1
+ <div class="alert alert-danger">
2
+ <strong>Could not reset Password</strong>
3
+ </div>
4
+
5
+ <p>
6
+ Your password reset request looks invalid. Please try again.
7
+ </p>
@@ -3,7 +3,7 @@
3
3
  <div class="col-md-6 col-md-offset-3" style="margin: 0 auto;float:none;">
4
4
  <h2><%= @website_section.title %></h2>
5
5
 
6
- <%= render_widget :reset_password, :params => {:login_url => "/login"} %>
6
+ <%= render_widget :reset_password, :params => {:login_url => "/login", :reset_password_url => '/reset-password'} %>
7
7
 
8
8
  </div>
9
9
  </div>
@@ -0,0 +1,39 @@
1
+ <% if @user && !@user.errors.empty? %>
2
+ <div class="alert alert-danger">
3
+ <h2>There was an error.</h2>
4
+
5
+ <h3>Please address the following issues</h3>
6
+ <hr>
7
+ <ul>
8
+ <% @user.errors.each do |attribute, error| %>
9
+ <li class="error_text"><%= attribute.to_s.capitalize %> : <%= error %> </li>
10
+ <% end %>
11
+ </ul>
12
+ </div>
13
+ <% end %>
14
+
15
+ <div id="<%= widget_result_id %>">
16
+ <%= form_remote_tag build_widget_url(:update_password), :class => "form-update_password" do %>
17
+ <div class="form_settings">
18
+
19
+ <div class="form-group">
20
+ <label for="password">Enter a password</label>
21
+ <%= password_field_tag :password, nil, :class => "form-control", :placeholder => "", :required => true %>
22
+ <span>Password must be between 8 and 20 characters with no spaces</span>
23
+ </div>
24
+
25
+ <div class="form-group">
26
+ <label for="password_confirmation">Confirm your password</label>
27
+ <%= password_field_tag :password_confirmation, nil, :class => "form-control", :placeholder => "", :required => true %>
28
+ </div>
29
+
30
+ <p class="text-center">
31
+ <%= submit_tag "Update Password", :disable_with => "Please wait...", :class => "btn btn-primary submit", :style => '' %>
32
+ </p>
33
+
34
+ <input type="hidden" value="<%= @token %>" name="token"/>
35
+ <input type="hidden" value="<%= @login_url %>" name="login_url"/>
36
+
37
+ </div>
38
+ <% end %>
39
+ </div>
@@ -0,0 +1,5 @@
1
+
2
+ <div class="alert alert-success">
3
+ <h3>Success</h3>
4
+ </div>
5
+ <p>Your password has successfully been reset. Please <a href="<%= @login_url %>">Login</a></p>
@@ -6,12 +6,12 @@ module Widgets
6
6
  include WillPaginate::ActionView
7
7
 
8
8
  def index
9
- @section_unique_name = params[:section_unique_name]
9
+ @section_unique_name = params[:section_to_search]
10
10
  @content_type = params[:content_type]
11
- @search_url = params[:search_url]
11
+ @results_permalink = params[:results_permalink]
12
12
  @per_page = params[:per_page] || 10
13
- @redirect_results = params[:redirect_results] || false
14
- @inline = params[:inline]
13
+ @redirect_results = params[:redirect_results]
14
+ @inline = !@results_permalink.blank?
15
15
  @results = nil
16
16
 
17
17
  if params[:query].present?
@@ -25,7 +25,7 @@ module Widgets
25
25
  end
26
26
 
27
27
  def search
28
- @query = params[:query].strip
28
+ @query = params[:search_query].strip
29
29
  @content_type = params[:content_type]
30
30
  @section_unique_name = params[:section_unique_name]
31
31
  @per_page = params[:per_page]
@@ -2,18 +2,18 @@ Compass.ErpApp.Widgets.Search = {
2
2
  template: new Ext.Template(
3
3
  "<% #Optional Parameters:\n",
4
4
  " # content_type: Leave blank to search all section types, set to Blog to only search Blog articles\n",
5
- " # section_permalink: This is the permalink value for the section \n",
6
- " # Useful if you only want to search articles within a single Blog section\n",
5
+ " # section_to_search: If set will only search for content within the specified section. Set using a sections internal_identifier. \n",
7
6
  " # results_permalink: How do you want your results to display? via ajax? or on a new page?\n",
8
7
  " # Leave blank if you want results to display via ajax on the same page as the search form\n",
9
8
  " # Enter the permalink of results page if you want the search results to display on a new page\n",
10
9
  " # per_page: Number of results per page \n",
11
- " # class: CSS class for the form %>\n",
10
+ " # class: CSS class for the form \n",
11
+ "%>\n",
12
12
  "<%= render_widget :search, \n",
13
13
  " :action => get_widget_action,\n",
14
14
  " :params => set_widget_params({\n",
15
15
  " :content_type => '',\n",
16
- " :section_permalink => '',\n",
16
+ " :section_to_search => '',\n",
17
17
  " :results_permalink => '',\n",
18
18
  " :per_page => 20,\n",
19
19
  " :class => ''}) %>\n"
@@ -22,11 +22,11 @@ Compass.ErpApp.Widgets.Search = {
22
22
  addSearch:function(){
23
23
  Ext.getCmp('knitkitCenterRegion').addContentToActiveCodeMirror(Compass.ErpApp.Widgets.Search.template.apply());
24
24
  }
25
- }
25
+ };
26
26
 
27
27
  Compass.ErpApp.Widgets.AvailableWidgets.push({
28
28
  name:'Search',
29
- iconUrl:'/images/icons/search/search_48x48.png',
29
+ iconUrl:'/assets/icons/search/search_48x48.png',
30
30
  onClick:Compass.ErpApp.Widgets.Search.addSearch,
31
31
  about:'This widget allows users to search for content in a website.'
32
32
  });
@@ -1,12 +1,23 @@
1
- <%= form_tag @search_url, :class => "form-inline" do %>
2
- <div class="form-group">
3
- <%= label_tag :search_for, 'Search For', :class => "sr-only" %>
4
- <%= text_field_tag :query, @query, class: 'form-control', required: true %>
5
- </div>
6
-
7
- <%= hidden_field_tag :section_unique_name, @section_unique_name %>
8
- <%= hidden_field_tag :content_type, @content_type %>
9
- <%= hidden_field_tag :per_page, @per_page %>
10
-
11
- <%= submit_tag "Search", :disable_with => "Please wait...", :class => "btn btn-primary submit" %>
12
- <% end %>
1
+ <div class="col-md-2 pull-right">
2
+ <!-- this should not be necessary. aren't glyphicons included in -->
3
+
4
+ <%= form_tag '/search-results', :class => "inline-search-header" do %>
5
+ <div class="input-group">
6
+
7
+ <%= text_field_tag :search_query, @query, class: 'form-control', size: 25, required: true, placeholder: 'Search site...' %>
8
+
9
+
10
+ <%= hidden_field_tag :section_unique_name, @section_unique_name %>
11
+ <%= hidden_field_tag :content_type, @content_type %>
12
+ <%= hidden_field_tag :per_page, @per_page %>
13
+
14
+ <span class="input-group-btn">
15
+ <button type="submit" class="btn btn-default">
16
+ <span class="glyphicon glyphicon-search"></span>
17
+ </button>
18
+ </span>
19
+ </div>
20
+ <% end %>
21
+ </div>
22
+
23
+
@@ -1,41 +1,45 @@
1
1
  <%= form_tag (@redirect_results ? @search_url : build_widget_url(:search)), :remote => !@redirect_results do %>
2
- <div class="form-group">
3
- <%= label_tag :search_for, 'Search For' %>
4
- <%= text_field_tag :query, @query, class: 'form-control', required: true %>
5
- </div>
2
+ <div class="form-group">
3
+ <%= label_tag :search_for, 'Search For' %>
4
+ <%= text_field_tag :search_query, @query, class: 'form-control', required: true %>
5
+ </div>
6
6
 
7
- <%= hidden_field_tag :section_unique_name, @section_unique_name %>
8
- <%= hidden_field_tag :content_type, @content_type %>
9
- <%= hidden_field_tag :per_page, @per_page %>
7
+ <%= hidden_field_tag :section_unique_name, @section_unique_name %>
8
+ <%= hidden_field_tag :content_type, @content_type %>
9
+ <%= hidden_field_tag :per_page, @per_page %>
10
10
 
11
- <p class="form-group">
12
- <%= submit_tag "Search", :disable_with => "Please wait...", :class => "btn btn-primary submit" %>
13
- </p>
11
+ <p class="form-group">
12
+ <%= submit_tag "Search", :disable_with => "Please wait...", :class => "btn btn-primary submit" %>
13
+ </p>
14
14
  <% end %>
15
15
  <br/>
16
16
  <div id="<%= widget_result_id %>">
17
17
  <% if @results %>
18
+ <% if @results.count == 0 %>
19
+ <h2>No Results</h2>
20
+ <% else %>
18
21
  <% @results.each do |r| %>
19
- <p>
20
- <a href="<%= r[:link] %>"><%= r[:title] %></a><br/>
21
- <%= sanitize(r[:content].body_html[0..500], :tags => []) unless r[:content].body_html.nil? %><br/>
22
- </p>
22
+ <p>
23
+ <a href="<%= r[:link] %>"><%= r[:title] %></a><br/>
24
+ <%= sanitize(r[:content].body_html[0..500], :tags => []) unless r[:content].body_html.nil? %><br/>
25
+ </p>
23
26
  <% end %>
24
- <%=
25
- will_paginate @results,
26
- :renderer => Knitkit::Extensions::WillPaginate::LinkRenderer,
27
- :params => {
28
- :widget_name => 'search',
29
- :widget_action => 'search',
30
- :uuid => @uuid,
31
- :query => @query,
32
- :content_type => @content_type,
33
- :section_unique_name => @section_unique_name,
34
- :per_page => @per_page,
35
- :controller => 'erp_app/widget_proxy',
36
- :only_path => true,
37
- :scope => erp_app
38
- }
39
- %>
27
+ <% end %>
28
+ <%=
29
+ will_paginate @results,
30
+ :renderer => Knitkit::Extensions::WillPaginate::LinkRenderer,
31
+ :params => {
32
+ :widget_name => 'search',
33
+ :widget_action => 'search',
34
+ :uuid => @uuid,
35
+ :query => @query,
36
+ :content_type => @content_type,
37
+ :section_unique_name => @section_unique_name,
38
+ :per_page => @per_page,
39
+ :controller => 'erp_app/widget_proxy',
40
+ :only_path => true,
41
+ :scope => erp_app
42
+ }
43
+ %>
40
44
  <% end %>
41
45
  </div>