knitkit 3.0.0 → 3.2.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/{public → app/assets}/images/check.png +0 -0
- data/{public → app/assets}/images/credit_card.png +0 -0
- data/{public → app/assets}/images/inline_edit/close.png +0 -0
- data/{public → app/assets}/images/knitkit/icons/document.png +0 -0
- data/{public → app/assets}/images/knitkit/icons/multi_doc.png +0 -0
- data/{public → app/assets}/images/knitkit/logo.png +0 -0
- data/{public → app/assets}/images/knitkit/splash/images/add-site.png +0 -0
- data/app/assets/images/knitkit/splash/images/add_website_105x105-active.png +0 -0
- data/app/assets/images/knitkit/splash/images/add_website_105x105.png +0 -0
- data/{public → app/assets}/images/knitkit/splash/images/adjust-site.png +0 -0
- data/{public → app/assets}/images/knitkit/splash/images/browse-site.png +0 -0
- data/app/assets/images/knitkit/splash/images/browse_db_105x105-active.png +0 -0
- data/app/assets/images/knitkit/splash/images/browse_db_105x105.png +0 -0
- data/app/assets/images/knitkit/splash/images/console_105x105-active.png +0 -0
- data/app/assets/images/knitkit/splash/images/console_105x105.png +0 -0
- data/{public → app/assets}/images/knitkit/splash/images/find-themes.png +0 -0
- data/app/assets/images/knitkit/splash/images/find_themes_105x105-active.png +0 -0
- data/app/assets/images/knitkit/splash/images/find_themes_105x105.png +0 -0
- data/app/assets/images/knitkit/splash/images/learn_more_105x105-active.png +0 -0
- data/app/assets/images/knitkit/splash/images/learn_more_105x105.png +0 -0
- data/{public → app/assets}/images/knitkit/splash/images/settings.png +0 -0
- data/{public → app/assets}/images/knitkit/splash/images/tutorials.png +0 -0
- data/app/assets/images/knitkit/splash/splash.png +0 -0
- data/app/assets/images/widgets/manage_profile/contact_information.png +0 -0
- data/app/assets/images/widgets/manage_profile/password.png +0 -0
- data/app/assets/images/widgets/manage_profile/user_information.png +0 -0
- data/app/assets/javascripts/erp_app/desktop/applications/knitkit/app.js +24 -0
- data/{public → app/assets}/javascripts/erp_app/desktop/applications/knitkit/articles_grid_panel.js +15 -12
- data/{public → app/assets}/javascripts/erp_app/desktop/applications/knitkit/center_region.js +69 -48
- data/app/assets/javascripts/erp_app/desktop/applications/knitkit/comments_grid_panel.js +214 -0
- data/{public → app/assets}/javascripts/erp_app/desktop/applications/knitkit/east_region/east_region.js +0 -0
- data/{public → app/assets}/javascripts/erp_app/desktop/applications/knitkit/east_region/file_assets_panel.js +17 -19
- data/{public → app/assets}/javascripts/erp_app/desktop/applications/knitkit/east_region/image_assets_data_view.js +13 -3
- data/{public → app/assets}/javascripts/erp_app/desktop/applications/knitkit/east_region/image_assets_panel.js +59 -48
- data/{public → app/assets}/javascripts/erp_app/desktop/applications/knitkit/east_region/widgets_panel.js +0 -0
- data/{public → app/assets}/javascripts/erp_app/desktop/applications/knitkit/inquiries_grid_panel.js +2 -2
- data/{public → app/assets}/javascripts/erp_app/desktop/applications/knitkit/module.js +2 -2
- data/{public → app/assets}/javascripts/erp_app/desktop/applications/knitkit/publish_window.js +0 -0
- data/{public → app/assets}/javascripts/erp_app/desktop/applications/knitkit/published_grid_panel.js +1 -1
- data/app/assets/javascripts/erp_app/desktop/applications/knitkit/splash_screen.js +268 -0
- data/{public → app/assets}/javascripts/erp_app/desktop/applications/knitkit/top_menu/main_menu.js +85 -33
- data/{public → app/assets}/javascripts/erp_app/desktop/applications/knitkit/top_menu/websites_combo.js +0 -0
- data/{public → app/assets}/javascripts/erp_app/desktop/applications/knitkit/versions_grid_panel.js +5 -28
- data/{public → app/assets}/javascripts/erp_app/desktop/applications/knitkit/west_region/helpers/article.js +22 -8
- data/{public → app/assets}/javascripts/erp_app/desktop/applications/knitkit/west_region/helpers/document.js +143 -25
- data/{public → app/assets}/javascripts/erp_app/desktop/applications/knitkit/west_region/helpers/host.js +5 -1
- data/{public → app/assets}/javascripts/erp_app/desktop/applications/knitkit/west_region/helpers/menu.js +2 -0
- data/{public → app/assets}/javascripts/erp_app/desktop/applications/knitkit/west_region/helpers/section.js +181 -65
- data/{public → app/assets}/javascripts/erp_app/desktop/applications/knitkit/west_region/helpers/website_nav_items.js +0 -0
- data/{public → app/assets}/javascripts/erp_app/desktop/applications/knitkit/west_region/hosts_tree_panel.js +0 -0
- data/{public → app/assets}/javascripts/erp_app/desktop/applications/knitkit/west_region/menu_tree_panel.js +0 -0
- data/{public → app/assets}/javascripts/erp_app/desktop/applications/knitkit/west_region/site_contents_tree_panel.js +121 -116
- data/{public → app/assets}/javascripts/erp_app/desktop/applications/knitkit/west_region/themes_tree_panel.js +101 -10
- data/{public → app/assets}/javascripts/erp_app/desktop/applications/knitkit/west_region/west_region.js +9 -5
- data/app/assets/javascripts/knitkit-web.js +22 -0
- data/app/assets/javascripts/knitkit/additional-methods.min.js +4 -0
- data/app/assets/javascripts/knitkit/bootstrap.min.js +7 -0
- data/app/assets/javascripts/knitkit/captcha.js +154 -0
- data/{public → app/assets}/javascripts/knitkit/confirm-bootstrap.js +1 -1
- data/{public → app/assets}/javascripts/knitkit/inline_editing.js +1 -1
- data/{public → app/assets}/javascripts/knitkit/jquery.maskedinput.min.js +0 -0
- data/app/assets/javascripts/knitkit/jquery.validate.min.js +4 -0
- data/app/assets/javascripts/knitkit/js.cookie.js +145 -0
- data/{public → app/assets}/javascripts/knitkit/theme.js +0 -0
- data/app/assets/stylesheets/erp_app/desktop/applications/knitkit/app.css +12 -0
- data/{public → app/assets}/stylesheets/erp_app/desktop/applications/knitkit/knitkit.css +23 -33
- data/app/assets/stylesheets/erp_app/shared/knitkit_shared.css +21 -0
- data/app/assets/stylesheets/fonts/glyphicons-halflings-regular.eot +0 -0
- data/app/assets/stylesheets/fonts/glyphicons-halflings-regular.svg +288 -0
- data/app/assets/stylesheets/fonts/glyphicons-halflings-regular.ttf +0 -0
- data/app/assets/stylesheets/fonts/glyphicons-halflings-regular.woff +0 -0
- data/app/assets/stylesheets/fonts/glyphicons-halflings-regular.woff2 +0 -0
- data/app/assets/stylesheets/knitkit-web.css +16 -0
- data/app/assets/stylesheets/knitkit/bootstrap.min.css +5 -0
- data/app/assets/stylesheets/knitkit/captcha.css +59 -0
- data/app/assets/stylesheets/knitkit/custom.css +144 -0
- data/{public → app/assets}/stylesheets/knitkit/inline_editing.css +0 -0
- data/app/assets/stylesheets/knitkit/submenu.css +93 -0
- data/app/controllers/api/v1/websites_controller.rb +14 -0
- data/app/controllers/captcha_controller.rb +53 -0
- data/app/controllers/knitkit/base_controller.rb +1 -5
- data/app/controllers/knitkit/erp_app/desktop/app_controller.rb +2 -9
- data/app/controllers/knitkit/erp_app/desktop/articles_controller.rb +20 -7
- data/app/controllers/knitkit/erp_app/desktop/file_assets_controller.rb +38 -28
- data/app/controllers/knitkit/erp_app/desktop/image_assets_controller.rb +16 -9
- data/app/controllers/knitkit/erp_app/desktop/online_document_sections_controller.rb +69 -15
- data/app/controllers/knitkit/erp_app/desktop/position_controller.rb +45 -58
- data/app/controllers/knitkit/erp_app/desktop/theme_controller.rb +64 -29
- data/app/controllers/knitkit/erp_app/desktop/website_controller.rb +36 -13
- data/app/controllers/knitkit/erp_app/desktop/website_host_controller.rb +12 -0
- data/app/controllers/knitkit/erp_app/desktop/website_nav_controller.rb +4 -11
- data/app/controllers/knitkit/erp_app/desktop/website_nav_item_controller.rb +2 -9
- data/app/controllers/knitkit/erp_app/desktop/website_section_controller.rb +56 -20
- data/app/controllers/knitkit/online_document_sections_controller.rb +9 -3
- data/app/mailers/website_inquiry_mailer.rb +11 -3
- data/app/models/content.rb +16 -6
- data/app/models/documented_item.rb +12 -1
- data/app/models/online_document_section.rb +54 -20
- data/app/models/published_website.rb +16 -0
- data/app/models/theme.rb +53 -47
- data/app/models/website.rb +172 -191
- data/app/models/website_section.rb +64 -30
- data/app/views/knitkit/blogs/show.html.erb +5 -2
- data/app/views/layouts/knitkit/base.html.erb +54 -51
- data/app/views/menus/knitkit/_default_menu.html.erb +11 -11
- data/app/views/menus/knitkit/_default_section_menu.html.erb +2 -2
- data/app/views/menus/knitkit/_default_sub_menu.erb +27 -0
- data/app/views/menus/knitkit/_default_sub_section_menu.html.erb +30 -0
- data/app/views/website_inquiry_mailer/inquiry.html.erb +266 -0
- data/app/widgets/contact_us/base.rb +26 -16
- data/app/widgets/contact_us/javascript/contact_us.js +1 -1
- data/app/widgets/contact_us/views/error.html.erb +7 -3
- data/app/widgets/contact_us/views/index.html.erb +36 -28
- data/app/widgets/google_map/javascript/google_map.js +1 -1
- data/app/widgets/google_map/views/index.html.erb +1 -1
- data/app/widgets/login/javascript/login.js +1 -1
- data/app/widgets/login/views/index.html.erb +1 -1
- data/app/widgets/manage_profile/base.rb +141 -112
- data/app/widgets/manage_profile/javascript/manage_profile.js +2 -2
- data/app/widgets/manage_profile/views/_password_form.html.erb +1 -1
- data/app/widgets/manage_profile/views/_user_information_form.html.erb +1 -30
- data/app/widgets/manage_profile/views/index.html.erb +42 -40
- data/app/widgets/reset_password/base.rb +39 -8
- data/app/widgets/reset_password/javascript/reset_password.js +1 -1
- data/app/widgets/reset_password/views/index.html.erb +3 -3
- data/app/widgets/reset_password/views/invalid_reset_token.html.erb +7 -0
- data/app/widgets/reset_password/views/layouts/base.html.erb +1 -1
- data/app/widgets/reset_password/views/reset_password.html.erb +39 -0
- data/app/widgets/reset_password/views/reset_success.html.erb +5 -0
- data/app/widgets/search/base.rb +5 -5
- data/app/widgets/search/javascript/search.js +6 -6
- data/app/widgets/search/views/_inline_search_form.html.erb +23 -12
- data/app/widgets/search/views/_search_form.html.erb +34 -30
- data/app/widgets/search/views/layouts/base.html.erb +6 -1
- data/app/widgets/signup/base.rb +73 -30
- data/app/widgets/signup/javascript/signup.js +1 -1
- data/app/widgets/signup/views/_signup_form.html.erb +2 -1
- data/app/widgets/signup/views/layouts/base.html.erb +1 -1
- data/app/widgets/signup/views/success.html.erb +2 -3
- data/config/routes.rb +25 -4
- data/db/data_migrations/20110509223702_add_publisher_role.rb +0 -2
- data/db/data_migrations/20110816153456_add_knitkit_application.rb +7 -15
- data/db/data_migrations/20120127150505_create_website_default_configuration.rb +63 -3
- data/db/data_migrations/20150118180450_add_website_member_roles.rb +12 -0
- data/db/data_migrations/20150414150359_nest_knitkit_security_roles.rb +35 -0
- data/db/data_migrations/20150414173437_move_website_roles_under_website_builder.rb +19 -0
- data/db/migrate/20110211002317_setup_knitkit.rb +86 -39
- data/lib/knitkit.rb +8 -2
- data/lib/knitkit/config.rb +2 -3
- data/lib/knitkit/engine.rb +35 -4
- data/lib/knitkit/extensions.rb +2 -1
- data/lib/knitkit/extensions/action_controller/theme_support/acts_as_themed_controller.rb +1 -1
- data/lib/knitkit/extensions/action_mailer/theme_support/acts_as_themed_mailer.rb +1 -1
- data/lib/knitkit/extensions/compass_ae/mailers/user_mailer.rb +31 -0
- data/lib/knitkit/extensions/compass_ae/widgets/base.rb +1 -1
- data/lib/knitkit/extensions/railties/action_controller/captcha_helper.rb +43 -0
- data/lib/knitkit/extensions/railties/action_view/helpers/content_helper.rb +1 -1
- data/lib/knitkit/extensions/railties/action_view/helpers/menu_helper.rb +11 -1
- data/lib/knitkit/extensions/railties/theme_support/asset_tag_helper.rb +83 -0
- data/lib/knitkit/routing_filter/section_router.rb +24 -14
- data/lib/knitkit/version.rb +1 -1
- data/lib/tasks/knitkit_tasks.rake +89 -4
- data/lib/tasks/theme_parser.rake +85 -0
- data/public/fonts/glyphicons-halflings-regular.eot +0 -0
- data/public/fonts/glyphicons-halflings-regular.svg +288 -0
- data/public/fonts/glyphicons-halflings-regular.ttf +0 -0
- data/public/fonts/glyphicons-halflings-regular.woff +0 -0
- data/public/fonts/glyphicons-halflings-regular.woff2 +0 -0
- data/public/paypal-button.min.js +7 -0
- metadata +161 -82
- data/app/assets/javascripts/knitkit/application.js +0 -9
- data/app/assets/stylesheets/knitkit/application.css +0 -7
- data/app/mailers/document_mailer.rb +0 -10
- data/app/views/document_mailer/email_document.html.erb +0 -12
- data/app/views/knitkit/mobile/index.html.erb +0 -162
- data/app/views/knitkit/online_document_sections/index.html.erb +0 -279
- data/app/views/layouts/knitkit/online_document_sections.html.erb +0 -80
- data/app/views/website_inquiry_mailer/inquiry.erb +0 -24
- data/db/data_migrations/20120127150506_add_primary_host_to_website_configuration.rb +0 -33
- data/db/data_migrations/20120316150424_add_is_template_to_default_website_config.rb +0 -16
- data/db/data_migrations/20120809020508_update_website_and_configuration.rb +0 -82
- data/db/data_migrations/20121129185611_upgrade_website_role_iid.rb +0 -20
- data/db/migrate/20130405184234_add_use_markdown_to_section.rb +0 -19
- data/db/migrate/20131112013052_add_knitkit_missing_indexes.rb +0 -33
- data/db/migrate/20140622212723_update_website_inquiries.rb +0 -22
- data/db/migrate/20140911185022_add_publishing_to_website.rb +0 -5
- data/db/migrate/20141013073349_add_custom_fields_to_documents.rb +0 -12
- data/db/migrate/20141016101936_upgrade_remove_dynamic_attributes.rb +0 -13
- data/lib/knitkit/extensions/railties/theme_support/theme_file_resolver.rb +0 -49
- data/public/images/knitkit/close_window.png +0 -0
- data/public/images/knitkit/splash/splash.png +0 -0
- data/public/javascripts/erp_app/desktop/applications/knitkit/comments_grid_panel.js +0 -215
- data/public/javascripts/erp_app/desktop/applications/knitkit/select_roles_window.js +0 -108
- data/public/javascripts/erp_app/desktop/applications/knitkit/splash_screen.js +0 -170
- data/public/javascripts/knitkit/bootstrap-datepicker.js +0 -474
- data/public/javascripts/knitkit/bootstrap.min.js +0 -7
- data/public/javascripts/knitkit/mobile/app/view/Main.js +0 -108
- data/public/javascripts/knitkit/mobile/ux/slidenavigation/View.js +0 -734
- data/public/stylesheets/knitkit/bootstrap-responsive.min.css +0 -10
- data/public/stylesheets/knitkit/bootstrap.min.css +0 -7
- data/public/stylesheets/knitkit/custom.css +0 -122
- data/public/stylesheets/knitkit/datepicker.css +0 -182
@@ -1,31 +1,41 @@
|
|
1
1
|
module Widgets
|
2
2
|
module ContactUs
|
3
3
|
class Base < ErpApp::Widgets::Base
|
4
|
+
|
4
5
|
include ActionView::Helpers::SanitizeHelper
|
6
|
+
include Knitkit::Extensions::Railties::ActionController::CaptchaHelper
|
5
7
|
|
6
8
|
def index
|
7
9
|
render
|
8
10
|
end
|
9
11
|
|
10
12
|
def new
|
11
|
-
|
12
|
-
|
13
|
-
|
14
|
-
|
15
|
-
|
16
|
-
|
17
|
-
|
18
|
-
|
19
|
-
|
20
|
-
|
21
|
-
|
22
|
-
|
23
|
-
|
24
|
-
|
25
|
-
|
13
|
+
if captcha_valid?
|
14
|
+
|
15
|
+
website = Website.find_by_host(request.host_with_port)
|
16
|
+
|
17
|
+
website_inquiry = WebsiteInquiry.new
|
18
|
+
website_inquiry.created_by = current_user unless current_user.nil?
|
19
|
+
website_inquiry.website = website
|
20
|
+
website_inquiry.first_name = params[:first_name].strip
|
21
|
+
website_inquiry.last_name = params[:last_name].strip
|
22
|
+
website_inquiry.message = params[:message].strip
|
23
|
+
website_inquiry.email = params[:email].strip
|
24
|
+
|
25
|
+
if website_inquiry.save
|
26
|
+
if website.email_inquiries?
|
27
|
+
WebsiteInquiryMailer.inquiry(website_inquiry, website.dba_organization).deliver
|
28
|
+
end
|
29
|
+
render :update => {:id => "container", :view => :success}
|
26
30
|
|
31
|
+
else
|
32
|
+
@errors = website_inquiry.errors.full_messages
|
33
|
+
render :update => {:id => "#{@uuid}_result", :view => :error}
|
34
|
+
|
35
|
+
end
|
27
36
|
else
|
28
|
-
@errors =
|
37
|
+
@errors = ['Captcha Invalid']
|
38
|
+
|
29
39
|
render :update => {:id => "#{@uuid}_result", :view => :error}
|
30
40
|
|
31
41
|
end
|
@@ -8,7 +8,7 @@ Compass.ErpApp.Widgets.ContactUs = {
|
|
8
8
|
|
9
9
|
Compass.ErpApp.Widgets.AvailableWidgets.push({
|
10
10
|
name: 'Contact Us',
|
11
|
-
iconUrl: '/
|
11
|
+
iconUrl: '/assets/icons/mail/mail_48x48.png',
|
12
12
|
onClick: Compass.ErpApp.Widgets.ContactUs.addContactUs,
|
13
13
|
about: 'This widget creates a form to allow for website inquiries.'
|
14
14
|
});
|
@@ -1,8 +1,12 @@
|
|
1
1
|
<div class="alert alert-danger">
|
2
2
|
<strong>An Error Occurred</strong>
|
3
3
|
<ul>
|
4
|
-
<% @errors.each do |
|
5
|
-
<li><%=
|
4
|
+
<% @errors.each do |error| %>
|
5
|
+
<li><%= error %></li>
|
6
6
|
<% end %>
|
7
7
|
</ul>
|
8
|
-
</div>
|
8
|
+
</div>
|
9
|
+
|
10
|
+
<script type="text/javascript">
|
11
|
+
Captcha.refresh();
|
12
|
+
</script>
|
@@ -1,28 +1,36 @@
|
|
1
|
-
<div id="
|
2
|
-
|
3
|
-
|
4
|
-
|
5
|
-
|
6
|
-
|
7
|
-
|
8
|
-
|
9
|
-
|
10
|
-
|
11
|
-
|
12
|
-
|
13
|
-
|
14
|
-
|
15
|
-
|
16
|
-
|
17
|
-
|
18
|
-
|
19
|
-
|
20
|
-
|
21
|
-
|
22
|
-
|
23
|
-
|
24
|
-
|
25
|
-
|
26
|
-
|
27
|
-
|
28
|
-
|
1
|
+
<div id="container">
|
2
|
+
<div id="<%= widget_result_id %>"></div>
|
3
|
+
|
4
|
+
<%= form_remote_tag build_widget_url(:new) do %>
|
5
|
+
<div class="form-group">
|
6
|
+
<%= label_tag :first_name %>
|
7
|
+
<%= text_field_tag "first_name", nil, :class => "form-control", :required => true %>
|
8
|
+
</div>
|
9
|
+
|
10
|
+
<div class="form-group">
|
11
|
+
<%= label_tag :last_name %>
|
12
|
+
<%= text_field_tag "last_name", nil, :class => "form-control", :required => true %>
|
13
|
+
</div>
|
14
|
+
|
15
|
+
<div class="form-group">
|
16
|
+
<%= label_tag :email %>
|
17
|
+
<%= text_field_tag "email", nil, :class => "form-control", :required => true %>
|
18
|
+
</div>
|
19
|
+
|
20
|
+
<div class="form-group">
|
21
|
+
<%= label_tag :message %>
|
22
|
+
<%= text_area_tag "message", nil, :class => "form-control", :rows => 5, :required => true %>
|
23
|
+
</div>
|
24
|
+
|
25
|
+
<div id="captcha"></div>
|
26
|
+
|
27
|
+
<p class="text-center">
|
28
|
+
<%= submit_tag "Submit", :disable_with => "Please wait...", :class => "btn btn-primary submit", :style => '' %>
|
29
|
+
</p>
|
30
|
+
|
31
|
+
<% end %>
|
32
|
+
|
33
|
+
<script type="text/javascript">
|
34
|
+
Captcha.setup('captcha');
|
35
|
+
</script>
|
36
|
+
</div>
|
@@ -182,7 +182,7 @@ Compass.ErpApp.Widgets.GoogleMap = {
|
|
182
182
|
|
183
183
|
Compass.ErpApp.Widgets.AvailableWidgets.push({
|
184
184
|
name: 'Google Map',
|
185
|
-
iconUrl: '/
|
185
|
+
iconUrl: '/assets/icons/map/map_48x48.png',
|
186
186
|
onClick: Compass.ErpApp.Widgets.GoogleMap.addGoogleMap,
|
187
187
|
about: 'This widget creates a google map with drop points you setup.'
|
188
188
|
});
|
@@ -1,4 +1,4 @@
|
|
1
|
-
<div id='<%= @uuid %>' style='width
|
1
|
+
<div id='<%= @uuid %>' style='width: 100%;height:<%=@map_height%>px;border:solid 1px black;'></div>
|
2
2
|
<script type='text/javascript'>
|
3
3
|
//we do not want to load google libraries more than once.
|
4
4
|
window.loadMap_<%=@uuid%> = function () {
|
@@ -161,7 +161,7 @@ Compass.ErpApp.Widgets.Login = {
|
|
161
161
|
|
162
162
|
Compass.ErpApp.Widgets.AvailableWidgets.push({
|
163
163
|
name: 'Login',
|
164
|
-
iconUrl: '/
|
164
|
+
iconUrl: '/assets/icons/login/login_48x48.png',
|
165
165
|
onClick: Compass.ErpApp.Widgets.Login.addLogin,
|
166
166
|
about: 'This widget creates a login form to allow users to log into the website.'
|
167
167
|
});
|
@@ -41,8 +41,6 @@ module Widgets
|
|
41
41
|
@individual.current_first_name = params[:first_name]
|
42
42
|
@individual.current_last_name = params[:last_name]
|
43
43
|
@individual.current_middle_name = params[:middle_name]
|
44
|
-
@individual.gender = params[:gender]
|
45
|
-
@individual.birth_date = Date.strptime(params[:birth_date], '%m/%d/%Y')
|
46
44
|
@user.email = params[:email]
|
47
45
|
|
48
46
|
#### check validation then save and render message ####
|
@@ -65,159 +63,189 @@ module Widgets
|
|
65
63
|
|
66
64
|
end
|
67
65
|
|
68
|
-
|
69
66
|
def update_password
|
70
|
-
|
67
|
+
ActiveRecord::Base.connection.transaction do
|
68
|
+
begin
|
69
|
+
if @user = User.authenticate(current_user.username, params[:old_password])
|
70
|
+
|
71
|
+
if !params[:new_password].blank? && !params[:password_confirmation].blank? && params[:new_password] == params[:password_confirmation]
|
72
|
+
|
73
|
+
@user.password_confirmation= params[:password_confirmation]
|
74
|
+
|
75
|
+
if @user.change_password!(params[:new_password])
|
76
|
+
@message = "Password Updated"
|
71
77
|
|
72
|
-
|
78
|
+
render :update => {:id => "#{@uuid}_result", :view => :success}
|
79
|
+
else
|
80
|
+
@message = "Error Updating Password"
|
73
81
|
|
74
|
-
|
82
|
+
#### validation failed ####
|
83
|
+
render :update => {:id => "#{@uuid}_result", :view => :error}
|
84
|
+
end
|
75
85
|
|
76
|
-
|
77
|
-
|
86
|
+
else
|
87
|
+
#### password and password confirmation cant be blank or unequal ####
|
88
|
+
@message = "Password Confirmation Must Match Password"
|
78
89
|
|
79
|
-
|
90
|
+
render :update => {:id => "#{@uuid}_result", :view => :error}
|
91
|
+
end
|
80
92
|
else
|
81
|
-
|
93
|
+
#### old password wrong ####
|
94
|
+
@message = "Invalid Old Password"
|
82
95
|
|
83
|
-
#### validation failed ####
|
84
96
|
render :update => {:id => "#{@uuid}_result", :view => :error}
|
85
97
|
end
|
98
|
+
rescue => ex
|
99
|
+
Rails.logger.error ex.message
|
100
|
+
Rails.logger.error ex.backtrace.join("\n")
|
86
101
|
|
87
|
-
|
88
|
-
|
89
|
-
@message =
|
102
|
+
ExceptionNotifier.notify_exception(ex) if defined? ExceptionNotifier
|
103
|
+
|
104
|
+
@message = 'Could not update password'
|
90
105
|
|
91
106
|
render :update => {:id => "#{@uuid}_result", :view => :error}
|
92
107
|
end
|
93
|
-
else
|
94
|
-
#### old password wrong ####
|
95
|
-
@message = "Invalid Old Password"
|
96
|
-
|
97
|
-
render :update => {:id => "#{@uuid}_result", :view => :error}
|
98
108
|
end
|
99
109
|
|
100
110
|
end
|
101
111
|
|
102
112
|
def add_email_address
|
103
|
-
|
104
|
-
|
105
|
-
|
106
|
-
|
107
|
-
|
108
|
-
|
109
|
-
|
110
|
-
|
111
|
-
|
112
|
-
|
113
|
-
|
114
|
-
|
115
|
-
|
116
|
-
|
117
|
-
|
118
|
-
|
113
|
+
ActiveRecord::Base.connection.transaction do
|
114
|
+
begin
|
115
|
+
email_address = params[:email_address].strip
|
116
|
+
contact_purpose = params[:contact_purpose]
|
117
|
+
|
118
|
+
email = current_user.party.add_contact(EmailAddress,
|
119
|
+
{email_address: email_address},
|
120
|
+
ContactPurpose.find_by_internal_identifier(contact_purpose))
|
121
|
+
|
122
|
+
{:json => {success: true, message: 'Email added', email: email.to_hash(:only => [:id, :email_address],
|
123
|
+
:contact_purpose => ContactPurpose.find_by_internal_identifier(contact_purpose).description)}}
|
124
|
+
rescue => ex
|
125
|
+
Rails.logger.error ex.message
|
126
|
+
Rails.logger.error ex.backtrace.join("\n")
|
127
|
+
|
128
|
+
ExceptionNotifier.notify_exception(ex) if defined? ExceptionNotifier
|
129
|
+
|
130
|
+
{:json => {success: false, message: 'Could not add email'}}
|
131
|
+
end
|
119
132
|
end
|
120
133
|
end
|
121
134
|
|
122
135
|
def remove_email_address
|
123
|
-
|
124
|
-
|
136
|
+
ActiveRecord::Base.connection.transaction do
|
137
|
+
begin
|
138
|
+
email_address_id = params[:email_address_id].strip
|
139
|
+
|
140
|
+
EmailAddress.find(email_address_id).destroy
|
125
141
|
|
126
|
-
|
142
|
+
{:json => {success: true, message: 'Email removed'}}
|
143
|
+
rescue => ex
|
144
|
+
Rails.logger.error ex.message
|
145
|
+
Rails.logger.error ex.backtrace.join("\n")
|
127
146
|
|
128
|
-
|
129
|
-
rescue => ex
|
130
|
-
Rails.logger.error ex.message
|
131
|
-
Rails.logger.error ex.backtrace.join("\n")
|
132
|
-
#TODO send out notification
|
147
|
+
ExceptionNotifier.notify_exception(ex) if defined? ExceptionNotifier
|
133
148
|
|
134
|
-
|
149
|
+
{:json => {success: false, message: 'Could not remove email'}}
|
150
|
+
end
|
135
151
|
end
|
136
152
|
end
|
137
153
|
|
138
154
|
def add_phone_number
|
139
|
-
|
140
|
-
|
141
|
-
|
142
|
-
|
143
|
-
|
144
|
-
|
145
|
-
|
146
|
-
|
147
|
-
|
148
|
-
|
149
|
-
|
150
|
-
|
151
|
-
|
152
|
-
|
153
|
-
|
154
|
-
|
155
|
+
ActiveRecord::Base.connection.transaction do
|
156
|
+
begin
|
157
|
+
phone_number = params[:phone_number].strip
|
158
|
+
contact_purpose = params[:contact_purpose]
|
159
|
+
|
160
|
+
phone_number = current_user.party.add_contact(PhoneNumber,
|
161
|
+
{phone_number: phone_number},
|
162
|
+
ContactPurpose.find_by_internal_identifier(contact_purpose))
|
163
|
+
|
164
|
+
{:json => {success: true, message: 'Phone number added', phone: phone_number.to_hash(:only => [:id, :phone_number],
|
165
|
+
:contact_purpose => ContactPurpose.find_by_internal_identifier(contact_purpose).description)}}
|
166
|
+
rescue => ex
|
167
|
+
Rails.logger.error ex.message
|
168
|
+
Rails.logger.error ex.backtrace.join("\n")
|
169
|
+
|
170
|
+
ExceptionNotifier.notify_exception(ex) if defined? ExceptionNotifier
|
171
|
+
|
172
|
+
{:json => {success: false, message: 'Could not add phone number'}}
|
173
|
+
end
|
155
174
|
end
|
156
175
|
end
|
157
176
|
|
158
177
|
def remove_phone_number
|
159
|
-
|
160
|
-
|
178
|
+
ActiveRecord::Base.connection.transaction do
|
179
|
+
begin
|
180
|
+
phone_number_id = params[:phone_number_id].strip
|
161
181
|
|
162
|
-
|
182
|
+
PhoneNumber.find(phone_number_id).destroy
|
163
183
|
|
164
|
-
|
165
|
-
|
166
|
-
|
167
|
-
|
168
|
-
#TODO send out notification
|
184
|
+
{:json => {success: true, message: 'Phone number removed'}}
|
185
|
+
rescue => ex
|
186
|
+
Rails.logger.error ex.message
|
187
|
+
Rails.logger.error ex.backtrace.join("\n")
|
169
188
|
|
170
|
-
|
189
|
+
ExceptionNotifier.notify_exception(ex) if defined? ExceptionNotifier
|
190
|
+
|
191
|
+
{:json => {success: false, message: 'Could not remove phone number'}}
|
192
|
+
end
|
171
193
|
end
|
172
194
|
end
|
173
195
|
|
174
196
|
def add_address
|
175
|
-
|
176
|
-
|
177
|
-
|
178
|
-
|
179
|
-
|
180
|
-
|
181
|
-
|
182
|
-
|
183
|
-
|
184
|
-
|
185
|
-
|
186
|
-
|
187
|
-
|
188
|
-
|
189
|
-
|
190
|
-
|
191
|
-
|
192
|
-
|
193
|
-
|
194
|
-
|
195
|
-
|
196
|
-
|
197
|
-
|
198
|
-
|
199
|
-
|
200
|
-
|
201
|
-
|
202
|
-
|
203
|
-
|
204
|
-
|
197
|
+
ActiveRecord::Base.connection.transaction do
|
198
|
+
begin
|
199
|
+
address_line_1 = params[:address_line_1].strip
|
200
|
+
address_line_2 = params[:address_line_2].strip
|
201
|
+
city = params[:city].strip
|
202
|
+
geo_zone_id = params[:state].strip
|
203
|
+
postal_code = params[:postal_code].strip
|
204
|
+
contact_purpose = params[:contact_purpose]
|
205
|
+
|
206
|
+
postal_address = current_user.party.add_contact(PostalAddress,
|
207
|
+
{
|
208
|
+
address_line_1: address_line_1,
|
209
|
+
address_line_2: address_line_2,
|
210
|
+
city: city,
|
211
|
+
geo_zone_id: geo_zone_id,
|
212
|
+
state: GeoZone.find(geo_zone_id).zone_name,
|
213
|
+
zip: postal_code,
|
214
|
+
},
|
215
|
+
ContactPurpose.find_by_internal_identifier(contact_purpose))
|
216
|
+
|
217
|
+
{:json => {success: true,
|
218
|
+
message: 'Address added',
|
219
|
+
address: postal_address.to_hash(:only => [:id, :address_line_1, :address_line_2,
|
220
|
+
:city, :state, :zip],
|
221
|
+
:contact_purpose => ContactPurpose.find_by_internal_identifier(contact_purpose).description)}}
|
222
|
+
rescue => ex
|
223
|
+
Rails.logger.error ex.message
|
224
|
+
Rails.logger.error ex.backtrace.join("\n")
|
225
|
+
|
226
|
+
ExceptionNotifier.notify_exception(ex) if defined? ExceptionNotifier
|
227
|
+
|
228
|
+
{:json => {success: false, message: 'Could not add address'}}
|
229
|
+
end
|
205
230
|
end
|
206
231
|
end
|
207
232
|
|
208
233
|
def remove_address
|
209
|
-
|
210
|
-
|
234
|
+
ActiveRecord::Base.connection.transaction do
|
235
|
+
begin
|
236
|
+
address_id = params[:address_id].strip
|
211
237
|
|
212
|
-
|
238
|
+
PostalAddress.find(address_id).destroy
|
213
239
|
|
214
|
-
|
215
|
-
|
216
|
-
|
217
|
-
|
218
|
-
#TODO send out notification
|
240
|
+
{:json => {success: true, message: 'address removed'}}
|
241
|
+
rescue => ex
|
242
|
+
Rails.logger.error ex.message
|
243
|
+
Rails.logger.error ex.backtrace.join("\n")
|
219
244
|
|
220
|
-
|
245
|
+
ExceptionNotifier.notify_exception(ex) if defined? ExceptionNotifier
|
246
|
+
|
247
|
+
{:json => {success: false, message: 'Could not remove address'}}
|
248
|
+
end
|
221
249
|
end
|
222
250
|
end
|
223
251
|
|
@@ -244,8 +272,9 @@ module Widgets
|
|
244
272
|
return nil
|
245
273
|
end
|
246
274
|
end
|
247
|
-
end
|
248
|
-
|
249
|
-
|
250
|
-
end
|
275
|
+
end # Class Methods
|
276
|
+
|
277
|
+
end # Base
|
278
|
+
end # ManageProfile
|
279
|
+
end # Widgets
|
251
280
|
|