From c870b00f650ddcda05d40adaf3a834298ad7d679 Mon Sep 17 00:00:00 2001 From: Andreas Nedbal Date: Sat, 25 Apr 2020 17:04:23 +0200 Subject: [PATCH] Clean up user setting layouts --- app/views/devise/registrations/edit.html.haml | 29 +-- app/views/layouts/user/settings.haml | 7 + app/views/services/index.haml | 4 + app/views/services/index.html.haml | 25 --- app/views/settings/_account.haml | 29 +++ app/views/settings/_data.haml | 189 +++++++++++++++++ app/views/settings/_export.haml | 32 +++ app/views/settings/_privacy.haml | 9 + app/views/settings/_profile.haml | 57 +++++ app/views/settings/_services.haml | 19 ++ app/views/settings/_theme.haml | 67 ++++++ app/views/tabs/_settings.haml | 11 + app/views/user/_account.html.haml | 33 --- app/views/user/_settings_tabs.html.haml | 12 -- app/views/user/data.haml | 4 + app/views/user/data.html.haml | 194 ------------------ app/views/user/edit.haml | 4 + app/views/user/edit.html.haml | 63 ------ app/views/user/edit_privacy.haml | 4 + app/views/user/edit_privacy.html.haml | 15 -- app/views/user/edit_theme.haml | 4 + app/views/user/edit_theme.html.haml | 73 ------- app/views/user/export.haml | 40 +--- 23 files changed, 446 insertions(+), 478 deletions(-) create mode 100644 app/views/layouts/user/settings.haml create mode 100644 app/views/services/index.haml delete mode 100644 app/views/services/index.html.haml create mode 100644 app/views/settings/_account.haml create mode 100644 app/views/settings/_data.haml create mode 100644 app/views/settings/_export.haml create mode 100644 app/views/settings/_privacy.haml create mode 100644 app/views/settings/_profile.haml create mode 100644 app/views/settings/_services.haml create mode 100644 app/views/settings/_theme.haml create mode 100644 app/views/tabs/_settings.haml delete mode 100644 app/views/user/_account.html.haml delete mode 100644 app/views/user/_settings_tabs.html.haml create mode 100644 app/views/user/data.haml delete mode 100644 app/views/user/data.html.haml create mode 100644 app/views/user/edit.haml delete mode 100644 app/views/user/edit.html.haml create mode 100644 app/views/user/edit_privacy.haml delete mode 100644 app/views/user/edit_privacy.html.haml create mode 100644 app/views/user/edit_theme.haml delete mode 100644 app/views/user/edit_theme.html.haml diff --git a/app/views/devise/registrations/edit.html.haml b/app/views/devise/registrations/edit.html.haml index e6ab70f8..77d692f8 100644 --- a/app/views/devise/registrations/edit.html.haml +++ b/app/views/devise/registrations/edit.html.haml @@ -1,27 +1,4 @@ -- case resource_name - - when :user - = render 'user/account' - - else - .container - %h1 Edit #{resource_name.to_s.humanize} - = bootstrap_form_for(resource, as: resource_name, url: registration_path(resource_name), html: { method: :put }) do |f| - = devise_error_messages! += render "settings/account" - = f.text_field :screen_name, autofocus: true, label: "User name" - - = f.email_field :email, label: "Email address" - - if devise_mapping.confirmable? && resource.pending_reconfirmation? - %div - Currently waiting confirmation for: #{resource.unconfirmed_email} - - = f.password_field :password, autocomplete: "off", label: "Password", help: "Leave this blank if you don't want to change it" - = f.password_field :password_confirmation, autocomplete: "off", label: "Confirm password" - - = f.password_field :current_password, autocomplete: "off", label: "Current password", help: "We need your current password to confirm your changes" - - = f.submit "Update" - %p - =button_to "Delete my account", registration_path(resource_name), data: { confirm: "Are you sure?" }, method: :delete, class: "btn btn-danger btn-sm" - - = link_to "Back", :back - = render 'shared/links' +- provide(:title, generate_title("Account Settings")) +- parent_layout "user/settings" diff --git a/app/views/layouts/user/settings.haml b/app/views/layouts/user/settings.haml new file mode 100644 index 00000000..ab396d4b --- /dev/null +++ b/app/views/layouts/user/settings.haml @@ -0,0 +1,7 @@ +.container.j2-page + .row + .col-md-3.col-xs-12.col-sm-4 + = render 'tabs/settings' + .col-md-9.col-xs-12.col-sm-8 + = render 'layouts/messages' + = yield \ No newline at end of file diff --git a/app/views/services/index.haml b/app/views/services/index.haml new file mode 100644 index 00000000..691d5076 --- /dev/null +++ b/app/views/services/index.haml @@ -0,0 +1,4 @@ += render "settings/services" + +- provide(:title, generate_title("Service Settings")) +- parent_layout "user/settings" diff --git a/app/views/services/index.html.haml b/app/views/services/index.html.haml deleted file mode 100644 index 597eb966..00000000 --- a/app/views/services/index.html.haml +++ /dev/null @@ -1,25 +0,0 @@ -- provide(:title, generate_title("Service Settings")) -.container.j2-page - .row - = render 'user/settings_tabs' - .col-md-9.col-xs-12.col-sm-8 - = render 'layouts/messages' - .card - .card-body - - if @services.count > 0 - = t 'views.settings.service.enabled' - - else - = t 'views.settings.service.none' - - - APP_CONFIG['sharing'].each do |service, service_options| - - if service_options['enabled'] and !@services.any? { |x| x.provider == service.to_s } - %p=link_to t('views.settings.service.connect', service: service.capitalize), "/auth/#{service}" - - - if @services.count > 0 - %ul.list-group - - @services.each do |service| - %li.list-group-item - %i{class: "fa fa-#{service.provider}"} - %strong= service.provider.capitalize - (#{service.nickname}) - = link_to t('views.settings.service.disconnect'), service_path(service), data: { confirm: t('views.settings.service.confirm', service: service.provider.capitalize) }, method: :delete diff --git a/app/views/settings/_account.haml b/app/views/settings/_account.haml new file mode 100644 index 00000000..bc34b0a9 --- /dev/null +++ b/app/views/settings/_account.haml @@ -0,0 +1,29 @@ +.card + .card-body + = bootstrap_form_for(resource, as: resource_name, url: '/settings/account', html: { method: :put }) do |f| + = render 'modal/password', f: f + + = devise_error_messages! + + = f.text_field :screen_name, autofocus: true, label: t('views.settings.account.username') + + = f.email_field :email, label: t('views.settings.account.email') + - if devise_mapping.confirmable? && resource.pending_reconfirmation? + %div= raw t('views.settings.account.email_confirm', resource: resource.unconfirmed_email) + + = f.password_field :password, autocomplete: "off", label: t('views.settings.account.password'), help: t('views.settings.account.password_help') + = f.password_field :password_confirmation, autocomplete: "off", label: t('views.settings.account.password_confirm') + + %button.btn.btn-primary{"data-target" => "#modal-passwd", "data-toggle" => "modal", :type => "button"} + = t 'views.actions.save' + + %hr/ + %p + = t 'views.settings.account.unsatisfied' + =button_to t('views.settings.account.delete'), '/settings/account', data: { confirm: "Are you sure?" }, method: :delete, class: "btn btn-danger btn-xs" + + = link_to t('views.settings.account.back'), :back + +.visible-xs= render "shared/links" + + diff --git a/app/views/settings/_data.haml b/app/views/settings/_data.haml new file mode 100644 index 00000000..35f0c3d1 --- /dev/null +++ b/app/views/settings/_data.haml @@ -0,0 +1,189 @@ +.card + .card-body + %h2 Your Profile Data + %p Everything we have about you! Really, not that much as you might expect. + + %h3 General + .row + .col-md-6.col-sm-6.col-xs-12 + %h4 Profile + + %p.data-heading User name + %p.text-muted= current_user.screen_name + + %p.data-heading Display name + %p.text-muted + - if current_user.display_name.blank? + None set! + - else + = current_user.display_name + + %p.data-heading Bio + %p.text-muted + - if current_user.bio.blank? + None set! + - else + = current_user.bio + + %p.data-heading Location + %p.text-muted + - if current_user.location.blank? + None set! + - else + = current_user.location + + %p.data-heading Website + %p.text-muted + - if current_user.website.blank? + None set! + - else + = current_user.website + .col-md-6.col-sm-6.col-xs-12 + %h4 Pictures + %p.data-heading Profile picture + .media + .pull-left + %img.profile--img{src: current_user.profile_picture.url(:medium)} + .media-body + %ul + %li + %a{href: current_user.profile_picture.url(:small)} Small + %li + %a{href: current_user.profile_picture.url(:medium)} Medium + %li + %a{href: current_user.profile_picture.url(:large)} Large + %li + %a{href: current_user.profile_picture.url(:original)} Original image + + %p.data-heading Header picture + %img.data-header-preview{src: current_user.profile_header.url(:mobile)} + %p + %a{href: current_user.profile_header.url(:mobile)} Mobile + | + %a{href: current_user.profile_header.url(:web)} Web + | + %a{href: current_user.profile_header.url(:retina)} Retina + | + %a{href: current_user.profile_header.url(:original)} Original image + .row + .col-md-6.col-sm-6.col-xs-12 + %h4 Statistics + + %p.data-heading Answers + %p.text-muted= current_user.answered_count + + %p.data-heading Questions + %p.text-muted= current_user.asked_count + + %p.data-heading Following + %p.text-muted= current_user.friend_count + + %p.data-heading Followers + %p.text-muted= current_user.follower_count + + %p.data-heading Smiles + %p.text-muted= current_user.smiled_count + current_user.comment_smiled_count + + %p.data-heading Comments + %p.text-muted= current_user.commented_count + .col-md-6.col-sm-6.col-xs-12 + %h4 Badges + + %p.data-heading Admin + %p + - if current_user.admin? + %span.label.label-success + %i.fa.fa-fw.fa-check + - else + %span.label.label-danger + %i.fa.fa-fw.fa-close + + %p.data-heading Moderator + %p + - if current_user.mod? + %span.label.label-success + %i.fa.fa-fw.fa-check + - else + %span.label.label-danger + %i.fa.fa-fw.fa-close + + %p.data-heading Supporter + %p + - if current_user.supporter? + %span.label.label-success + %i.fa.fa-fw.fa-check + - else + %span.label.label-danger + %i.fa.fa-fw.fa-close + + %p.data-heading Contributor + %p + - if current_user.contributor? + %span.label.label-success + %i.fa.fa-fw.fa-check + - else + %span.label.label-danger + %i.fa.fa-fw.fa-close + + %p.data-heading Blogger + %p + - if current_user.blogger? + %span.label.label-success + %i.fa.fa-fw.fa-check + - else + %span.label.label-danger + %i.fa.fa-fw.fa-close + + %p.data-heading Translator + %p + - if current_user.translator? + %span.label.label-success + %i.fa.fa-fw.fa-check + - else + %span.label.label-danger + %i.fa.fa-fw.fa-close + .row + .col-md-6.col-sm-6.col-xs-12 + %h3 IP + %p.data-heading Current Sign In + %p.text-muted= current_user.current_sign_in_ip + + %p.data-heading Last Sign In + %p.text-muted= current_user.last_sign_in_ip + .col-md-6.col-sm-6.col-xs-12 + %h3 Miscellaneous + + %p.data-heading Locale + %p.text-muted + - if current_user.locale.blank? + None set! + - else + = current_user.locale + + %p.data-heading Sign In count + %p.text-muted= current_user.sign_in_count + %h3 Dates + .row + .col-md-6.col-sm-6.col-xs-12 + %h4 Sign In + + %p.data-heading Current Sign In + %p.text-muted= localize(current_user.current_sign_in_at) + + %p.data-heading Last Sign In + %p.text-muted= localize(current_user.last_sign_in_at) + + %p.data-heading Remember me set at + %p.text-muted= localize(current_user.remember_created_at) + .col-md-6.col-sm-6.col-xs-12 + %h4 Create/Update + + %p.data-heading Account created + %p.text-muted + = localize(current_user.created_at) + = " (#{time_ago_in_words(current_user.created_at)} ago)" + + %p.data-heading Account last updated + %p.text-muted + = localize(current_user.updated_at) + = " (#{time_ago_in_words(current_user.updated_at)} ago)" \ No newline at end of file diff --git a/app/views/settings/_export.haml b/app/views/settings/_export.haml new file mode 100644 index 00000000..dd668173 --- /dev/null +++ b/app/views/settings/_export.haml @@ -0,0 +1,32 @@ +.card + .card-body + %h2 Export your data + %p + With the announcement of + = succeed ',' do + %a{href: 'http://blog.retrospring.net/saying-goodbye/'} shutting down Retrospring on June 8 2016 + we promised you one last feature: exporting all your data. The data is inside a + %code= ".tar.gz" + archive and available in three formats: YAML, JSON, and XML. The archive also contains a copy of your + profile picture and header picture in all sizes. + %p + Please note that you can only export your data once a week. Exporting your data + will take a while, so please be patient. You will receive a question once exporting + is done. + - if current_user.can_export? + %form{action: begin_user_export_path, method: 'POST'} + %p.centre + %button#export-btn.btn.btn-lg.btn-primary{type: :submit} Export + = hidden_field_tag :authenticity_token, form_authenticity_token + - else + %p.centre + %button.btn.btn-lg.btn-primary.disabled{disabled: :disabled} Export + %p + - if current_user.export_url.nil? + Once exporting your account is done, a download link will appear here. + - else + Here is your export from + = succeed ':' do + = current_user.export_created_at + %a{href: current_user.export_url} + = File.basename current_user.export_url \ No newline at end of file diff --git a/app/views/settings/_privacy.haml b/app/views/settings/_privacy.haml new file mode 100644 index 00000000..e3edd407 --- /dev/null +++ b/app/views/settings/_privacy.haml @@ -0,0 +1,9 @@ +.card + .card-body + = bootstrap_form_for(current_user, url: {action: "edit_privacy"}, method: "patch") do |f| + + = f.check_box :privacy_allow_anonymous_questions, label: t('views.settings.privacy.anonymous') + = f.check_box :privacy_allow_public_timeline, label: t('views.settings.privacy.public') + = f.check_box :privacy_allow_stranger_answers, label: t('views.settings.privacy.stranger') + + = f.submit t('views.actions.save'), class: 'btn btn-primary' \ No newline at end of file diff --git a/app/views/settings/_profile.haml b/app/views/settings/_profile.haml new file mode 100644 index 00000000..a6abf43b --- /dev/null +++ b/app/views/settings/_profile.haml @@ -0,0 +1,57 @@ +.card + .card-body + = bootstrap_form_for(current_user, url: {action: "edit"}, :html => { :multipart => true }, method: "patch") do |f| + + = f.text_field :display_name, label: t('views.settings.profile.displayname') + + .media#profile-picture-media + .pull-left + %img.img-rounded.profile--img{src: current_user.profile_picture.url(:medium)} + .media-body + = f.file_field :profile_picture, label: t('views.settings.profile.avatar') + + .row#profile-picture-crop-controls{style: 'display: none;'} + .col-sm-10.col-md-8 + %strong= t('views.settings.profile.avatar_adjust') + %img#profile-picture-cropper{src: current_user.profile_picture.url(:medium)} + .col-sm-2.col-md-4 + .btn-group + %button#cropper-zoom-out.btn.btn-inverse{type: :button} + %i.fa.fa-search-minus + %button#cropper-zoom-in.btn.btn-inverse{type: :button} + %i.fa.fa-search-plus + + .media#profile-header-media + .pull-left + %img.img-rounded.header--img{src: current_user.profile_header.url(:mobile)} + .media-body + = f.file_field :profile_header, label: t('views.settings.profile.header') + + .row#profile-header-crop-controls{style: 'display: none;'} + .col-sm-10.col-md-8 + %strong= t('views.settings.profile.header_adjust') + %img#profile-header-cropper{src: current_user.profile_header.url(:web)} + .col-sm-2.col-md-4 + .btn-group + %button#cropper-header-zoom-out.btn.btn-inverse{type: :button} + %i.fa.fa-search-minus + %button#cropper-header-zoom-in.btn.btn-inverse{type: :button} + %i.fa.fa-search-plus + + = f.text_field :motivation_header, label: t('views.settings.profile.motivation'), placeholder: t('views.settings.profile.placeholder.motivation') + + = f.text_field :website, label: t('views.settings.profile.website'), placeholder: 'http://example.com' + + = f.text_field :location, label: t('views.settings.profile.location'), placeholder: t('views.settings.profile.placeholder.location') + + = f.text_area :bio, label: t('views.settings.profile.bio'), placeholder: t('views.settings.profile.placeholder.bio') + + = f.check_box :show_foreign_themes, label: 'Render other user themes when visiting their profile' + + - for attrib in %i(crop_x crop_y crop_w crop_h) + = f.hidden_field attrib, id: attrib + + - for attrib in %i(crop_h_x crop_h_y crop_h_w crop_h_h) + = f.hidden_field attrib, id: attrib + + = f.submit t('views.actions.save'), class: 'btn btn-primary' \ No newline at end of file diff --git a/app/views/settings/_services.haml b/app/views/settings/_services.haml new file mode 100644 index 00000000..6967f0fc --- /dev/null +++ b/app/views/settings/_services.haml @@ -0,0 +1,19 @@ +.card + .card-body + - if @services.count > 0 + = t 'views.settings.service.enabled' + - else + = t 'views.settings.service.none' + + - APP_CONFIG['sharing'].each do |service, service_options| + - if service_options['enabled'] and !@services.any? { |x| x.provider == service.to_s } + %p=link_to t('views.settings.service.connect', service: service.capitalize), "/auth/#{service}" + + - if @services.count > 0 + %ul.list-group + - @services.each do |service| + %li.list-group-item + %i{class: "fa fa-#{service.provider}"} + %strong= service.provider.capitalize + (#{service.nickname}) + = link_to t('views.settings.service.disconnect'), service_path(service), data: { confirm: t('views.settings.service.confirm', service: service.provider.capitalize) }, method: :delete \ No newline at end of file diff --git a/app/views/settings/_theme.haml b/app/views/settings/_theme.haml new file mode 100644 index 00000000..e10a2a94 --- /dev/null +++ b/app/views/settings/_theme.haml @@ -0,0 +1,67 @@ +.card + .card-body + %b Presets: + %a{href: '#', class: 'theme_preset', data: {preset: 'rs'}} Retrospring Purple, + %a{href: '#', class: 'theme_preset', data: {preset: 'dc'}} Dark Copycat, + %a{href: '#', class: 'theme_preset', data: {preset: 'lc'}} Light Copycat + = bootstrap_form_for(current_user.theme || Theme.new, url: {action: "update_theme"}, html: {id: 'update_theme'}, method: "patch") do |f| + .row + .col-md-6 + = f.text_field :primary_color, class: 'color', data: {default: 0x5E35B1} + .col-md-6 + = f.text_field :primary_text, class: 'color', data: {default: 0xFFFFFF} + .row + .col-md-6 + = f.text_field :danger_color, class: 'color', data: {default: 0xFF0039} + .col-md-6 + = f.text_field :danger_text, class: 'color', data: {default: 0xFFFFFF} + .row + .col-md-6 + = f.text_field :success_color, class: 'color', data: {default: 0x3FB618} + .col-md-6 + = f.text_field :success_text, class: 'color', data: {default: 0xFFFFFF} + .row + .col-md-6 + = f.text_field :warning_color, class: 'color', data: {default: 0xFF7518} + .col-md-6 + = f.text_field :warning_text, class: 'color', data: {default: 0xFFFFFF} + .row + .col-md-6 + = f.text_field :info_color, class: 'color', data: {default: 0x9954BB} + .col-md-6 + = f.text_field :info_text, class: 'color', data: {default: 0xFFFFFF} + .row + .col-md-6 + = f.text_field :default_color, class: 'color', data: {default: 0x222222} + .col-md-6 + = f.text_field :default_text, class: 'color', data: {default: 0xEEEEEE} + .row + .col-md-6 + = f.text_field :panel_color, class: 'color', data: {default: 0xF9F9F9} + .col-md-6 + = f.text_field :panel_text, class: 'color', data: {default: 0x151515} + .row + .col-md-6 + = f.text_field :link_color, class: 'color', data: {default: 0x5E35B1} + .col-md-6 + = f.text_field :background_color, class: 'color', data: {default: 0xFFFFFF} + .row + .col-md-6 + = f.text_field :background_text, class: 'color', data: {default: 0x222222} + .col-md-6 + = f.text_field :background_muted, class: 'color', data: {default: 0xBBBBBB} + .row + .col-md-6 + = f.text_field :input_color, class: 'color', data: {default: 0xFFFFFF} + .col-md-6 + = f.text_field :input_text, class: 'color', data: {default: 0x000000} + .row + .col-md-6 + = f.text_field :outline_color, class: 'color', data: {default: 0x5E35B1} + .col-md-6 + + .pull-left + = f.submit t('views.actions.save'), class: 'btn btn-primary' + + .pull-right + =button_to 'Delete Theme', delete_user_theme_path, data: { confirm: "Are you sure?" }, tabindex: -1, method: :delete, class: "btn btn-danger" diff --git a/app/views/tabs/_settings.haml b/app/views/tabs/_settings.haml new file mode 100644 index 00000000..9eceb89a --- /dev/null +++ b/app/views/tabs/_settings.haml @@ -0,0 +1,11 @@ +.card + .list-group + = list_group_item t('views.settings.tabs.account'), edit_user_registration_path + = list_group_item t('views.settings.tabs.profile'), edit_user_profile_path + = list_group_item t('views.settings.tabs.privacy'), edit_user_privacy_path + = list_group_item t('views.settings.tabs.sharing'), services_path + = list_group_item 'Theme', edit_user_theme_path + = list_group_item "Your Data", user_data_path + = list_group_item 'Export', user_export_path + +.hidden-xs= render "shared/links" \ No newline at end of file diff --git a/app/views/user/_account.html.haml b/app/views/user/_account.html.haml deleted file mode 100644 index 0f5ee2b0..00000000 --- a/app/views/user/_account.html.haml +++ /dev/null @@ -1,33 +0,0 @@ -- provide(:title, generate_title("Account Settings")) -.container.j2-page - .row - = render 'user/settings_tabs' - .col-md-9.col-xs-12.col-sm-8 - = render 'layouts/messages' - .card - .card-body - = bootstrap_form_for(resource, as: resource_name, url: '/settings/account', html: { method: :put }) do |f| - = render 'modal/password', f: f - - = devise_error_messages! - - = f.text_field :screen_name, autofocus: true, label: t('views.settings.account.username') - - = f.email_field :email, label: t('views.settings.account.email') - - if devise_mapping.confirmable? && resource.pending_reconfirmation? - %div= raw t('views.settings.account.email_confirm', resource: resource.unconfirmed_email) - - = f.password_field :password, autocomplete: "off", label: t('views.settings.account.password'), help: t('views.settings.account.password_help') - = f.password_field :password_confirmation, autocomplete: "off", label: t('views.settings.account.password_confirm') - - %button.btn.btn-primary{"data-target" => "#modal-passwd", "data-toggle" => "modal", :type => "button"} - = t 'views.actions.save' - - %hr/ - %p - = t 'views.settings.account.unsatisfied' - =button_to t('views.settings.account.delete'), '/settings/account', data: { confirm: "Are you sure?" }, method: :delete, class: "btn btn-danger btn-xs" - - = link_to t('views.settings.account.back'), :back - -.visible-xs= render "shared/links" diff --git a/app/views/user/_settings_tabs.html.haml b/app/views/user/_settings_tabs.html.haml deleted file mode 100644 index d12b60fc..00000000 --- a/app/views/user/_settings_tabs.html.haml +++ /dev/null @@ -1,12 +0,0 @@ -.col-md-3.col-xs-12.col-sm-4 - .card - .list-group - = list_group_item t('views.settings.tabs.account'), edit_user_registration_path - = list_group_item t('views.settings.tabs.profile'), edit_user_profile_path - = list_group_item t('views.settings.tabs.privacy'), edit_user_privacy_path - = list_group_item t('views.settings.tabs.sharing'), services_path - = list_group_item 'Theme', edit_user_theme_path - = list_group_item "Your Data", user_data_path - = list_group_item 'Export', user_export_path - - .hidden-xs= render "shared/links" diff --git a/app/views/user/data.haml b/app/views/user/data.haml new file mode 100644 index 00000000..f2093748 --- /dev/null +++ b/app/views/user/data.haml @@ -0,0 +1,4 @@ += render "settings/data" + +- provide(:title, generate_title("Your Data")) +- parent_layout "user/settings" diff --git a/app/views/user/data.html.haml b/app/views/user/data.html.haml deleted file mode 100644 index 5e5d4b86..00000000 --- a/app/views/user/data.html.haml +++ /dev/null @@ -1,194 +0,0 @@ -- provide(:title, generate_title("Your Data")) -.container.j2-page - .row - = render 'settings_tabs' - .col-md-9.col-xs-12.col-sm-8 - .card - .card-body - %h2 Your Profile Data - %p Everything we have about you! Really, not that much as you might expect. - - %h3 General - .row - .col-md-6.col-sm-6.col-xs-12 - %h4 Profile - - %p.data-heading User name - %p.text-muted= current_user.screen_name - - %p.data-heading Display name - %p.text-muted - - if current_user.display_name.blank? - None set! - - else - = current_user.display_name - - %p.data-heading Bio - %p.text-muted - - if current_user.bio.blank? - None set! - - else - = current_user.bio - - %p.data-heading Location - %p.text-muted - - if current_user.location.blank? - None set! - - else - = current_user.location - - %p.data-heading Website - %p.text-muted - - if current_user.website.blank? - None set! - - else - = current_user.website - .col-md-6.col-sm-6.col-xs-12 - %h4 Pictures - %p.data-heading Profile picture - .media - .pull-left - %img.profile--img{src: current_user.profile_picture.url(:medium)} - .media-body - %ul - %li - %a{href: current_user.profile_picture.url(:small)} Small - %li - %a{href: current_user.profile_picture.url(:medium)} Medium - %li - %a{href: current_user.profile_picture.url(:large)} Large - %li - %a{href: current_user.profile_picture.url(:original)} Original image - - %p.data-heading Header picture - %img.data-header-preview{src: current_user.profile_header.url(:mobile)} - %p - %a{href: current_user.profile_header.url(:mobile)} Mobile - | - %a{href: current_user.profile_header.url(:web)} Web - | - %a{href: current_user.profile_header.url(:retina)} Retina - | - %a{href: current_user.profile_header.url(:original)} Original image - .row - .col-md-6.col-sm-6.col-xs-12 - %h4 Statistics - - %p.data-heading Answers - %p.text-muted= current_user.answered_count - - %p.data-heading Questions - %p.text-muted= current_user.asked_count - - %p.data-heading Following - %p.text-muted= current_user.friend_count - - %p.data-heading Followers - %p.text-muted= current_user.follower_count - - %p.data-heading Smiles - %p.text-muted= current_user.smiled_count + current_user.comment_smiled_count - - %p.data-heading Comments - %p.text-muted= current_user.commented_count - .col-md-6.col-sm-6.col-xs-12 - %h4 Badges - - %p.data-heading Admin - %p - - if current_user.admin? - %span.label.label-success - %i.fa.fa-fw.fa-check - - else - %span.label.label-danger - %i.fa.fa-fw.fa-close - - %p.data-heading Moderator - %p - - if current_user.mod? - %span.label.label-success - %i.fa.fa-fw.fa-check - - else - %span.label.label-danger - %i.fa.fa-fw.fa-close - - %p.data-heading Supporter - %p - - if current_user.supporter? - %span.label.label-success - %i.fa.fa-fw.fa-check - - else - %span.label.label-danger - %i.fa.fa-fw.fa-close - - %p.data-heading Contributor - %p - - if current_user.contributor? - %span.label.label-success - %i.fa.fa-fw.fa-check - - else - %span.label.label-danger - %i.fa.fa-fw.fa-close - - %p.data-heading Blogger - %p - - if current_user.blogger? - %span.label.label-success - %i.fa.fa-fw.fa-check - - else - %span.label.label-danger - %i.fa.fa-fw.fa-close - - %p.data-heading Translator - %p - - if current_user.translator? - %span.label.label-success - %i.fa.fa-fw.fa-check - - else - %span.label.label-danger - %i.fa.fa-fw.fa-close - .row - .col-md-6.col-sm-6.col-xs-12 - %h3 IP - %p.data-heading Current Sign In - %p.text-muted= current_user.current_sign_in_ip - - %p.data-heading Last Sign In - %p.text-muted= current_user.last_sign_in_ip - .col-md-6.col-sm-6.col-xs-12 - %h3 Miscellaneous - - %p.data-heading Locale - %p.text-muted - - if current_user.locale.blank? - None set! - - else - = current_user.locale - - %p.data-heading Sign In count - %p.text-muted= current_user.sign_in_count - %h3 Dates - .row - .col-md-6.col-sm-6.col-xs-12 - %h4 Sign In - - %p.data-heading Current Sign In - %p.text-muted= localize(current_user.current_sign_in_at) - - %p.data-heading Last Sign In - %p.text-muted= localize(current_user.last_sign_in_at) - - %p.data-heading Remember me set at - %p.text-muted= localize(current_user.remember_created_at) - .col-md-6.col-sm-6.col-xs-12 - %h4 Create/Update - - %p.data-heading Account created - %p.text-muted - = localize(current_user.created_at) - = " (#{time_ago_in_words(current_user.created_at)} ago)" - - %p.data-heading Account last updated - %p.text-muted - = localize(current_user.updated_at) - = " (#{time_ago_in_words(current_user.updated_at)} ago)" diff --git a/app/views/user/edit.haml b/app/views/user/edit.haml new file mode 100644 index 00000000..43a76cb4 --- /dev/null +++ b/app/views/user/edit.haml @@ -0,0 +1,4 @@ += render "settings/profile" + +- provide(:title, generate_title("Profile Settings")) +- parent_layout "user/settings" \ No newline at end of file diff --git a/app/views/user/edit.html.haml b/app/views/user/edit.html.haml deleted file mode 100644 index 6dd70f53..00000000 --- a/app/views/user/edit.html.haml +++ /dev/null @@ -1,63 +0,0 @@ -- provide(:title, generate_title("Profile Settings")) -.container.j2-page - .row - = render 'settings_tabs' - .col-md-9.col-xs-12.col-sm-9 - = render 'layouts/messages' - .card - .card-body - = bootstrap_form_for(current_user, url: {action: "edit"}, :html => { :multipart => true }, method: "patch") do |f| - - = f.text_field :display_name, label: t('views.settings.profile.displayname') - - .media#profile-picture-media - .pull-left - %img.img-rounded.profile--img{src: current_user.profile_picture.url(:medium)} - .media-body - = f.file_field :profile_picture, label: t('views.settings.profile.avatar') - - .row#profile-picture-crop-controls{style: 'display: none;'} - .col-sm-10.col-md-8 - %strong= t('views.settings.profile.avatar_adjust') - %img#profile-picture-cropper{src: current_user.profile_picture.url(:medium)} - .col-sm-2.col-md-4 - .btn-group - %button#cropper-zoom-out.btn.btn-inverse{type: :button} - %i.fa.fa-search-minus - %button#cropper-zoom-in.btn.btn-inverse{type: :button} - %i.fa.fa-search-plus - - .media#profile-header-media - .pull-left - %img.img-rounded.header--img{src: current_user.profile_header.url(:mobile)} - .media-body - = f.file_field :profile_header, label: t('views.settings.profile.header') - - .row#profile-header-crop-controls{style: 'display: none;'} - .col-sm-10.col-md-8 - %strong= t('views.settings.profile.header_adjust') - %img#profile-header-cropper{src: current_user.profile_header.url(:web)} - .col-sm-2.col-md-4 - .btn-group - %button#cropper-header-zoom-out.btn.btn-inverse{type: :button} - %i.fa.fa-search-minus - %button#cropper-header-zoom-in.btn.btn-inverse{type: :button} - %i.fa.fa-search-plus - - = f.text_field :motivation_header, label: t('views.settings.profile.motivation'), placeholder: t('views.settings.profile.placeholder.motivation') - - = f.text_field :website, label: t('views.settings.profile.website'), placeholder: 'http://example.com' - - = f.text_field :location, label: t('views.settings.profile.location'), placeholder: t('views.settings.profile.placeholder.location') - - = f.text_area :bio, label: t('views.settings.profile.bio'), placeholder: t('views.settings.profile.placeholder.bio') - - = f.check_box :show_foreign_themes, label: 'Render other user themes when visiting their profile' - - - for attrib in %i(crop_x crop_y crop_w crop_h) - = f.hidden_field attrib, id: attrib - - - for attrib in %i(crop_h_x crop_h_y crop_h_w crop_h_h) - = f.hidden_field attrib, id: attrib - - = f.submit t('views.actions.save'), class: 'btn btn-primary' diff --git a/app/views/user/edit_privacy.haml b/app/views/user/edit_privacy.haml new file mode 100644 index 00000000..c422fb37 --- /dev/null +++ b/app/views/user/edit_privacy.haml @@ -0,0 +1,4 @@ += render "settings/privacy" + +- provide(:title, generate_title("Privacy Settings")) +- parent_layout "user/settings" diff --git a/app/views/user/edit_privacy.html.haml b/app/views/user/edit_privacy.html.haml deleted file mode 100644 index 11d2920a..00000000 --- a/app/views/user/edit_privacy.html.haml +++ /dev/null @@ -1,15 +0,0 @@ -- provide(:title, generate_title("Privacy Settings")) -.container.j2-page - .row - = render 'settings_tabs' - .col-md-9.col-xs-12.col-sm-8 - = render 'layouts/messages' - .card - .card-body - = bootstrap_form_for(current_user, url: {action: "edit_privacy"}, method: "patch") do |f| - - = f.check_box :privacy_allow_anonymous_questions, label: t('views.settings.privacy.anonymous') - = f.check_box :privacy_allow_public_timeline, label: t('views.settings.privacy.public') - = f.check_box :privacy_allow_stranger_answers, label: t('views.settings.privacy.stranger') - - = f.submit t('views.actions.save'), class: 'btn btn-primary' diff --git a/app/views/user/edit_theme.haml b/app/views/user/edit_theme.haml new file mode 100644 index 00000000..38fec528 --- /dev/null +++ b/app/views/user/edit_theme.haml @@ -0,0 +1,4 @@ += render "settings/theme" + +- provide(:title, generate_title("Theme Settings")) +- parent_layout "user/settings" \ No newline at end of file diff --git a/app/views/user/edit_theme.html.haml b/app/views/user/edit_theme.html.haml deleted file mode 100644 index b551db07..00000000 --- a/app/views/user/edit_theme.html.haml +++ /dev/null @@ -1,73 +0,0 @@ -- provide(:title, generate_title("Theme Settings")) -.container.j2-page - .row - = render 'settings_tabs' - .col-md-9.col-xs-12.col-sm-8 - = render 'layouts/messages' - .card - .card-body - %b Presets: - %a{href: '#', class: 'theme_preset', data: {preset: 'rs'}} Retrospring Purple, - %a{href: '#', class: 'theme_preset', data: {preset: 'dc'}} Dark Copycat, - %a{href: '#', class: 'theme_preset', data: {preset: 'lc'}} Light Copycat - = bootstrap_form_for(current_user.theme || Theme.new, url: {action: "update_theme"}, html: {id: 'update_theme'}, method: "patch") do |f| - .row - .col-md-6 - = f.text_field :primary_color, class: 'color', data: {default: 0x5E35B1} - .col-md-6 - = f.text_field :primary_text, class: 'color', data: {default: 0xFFFFFF} - .row - .col-md-6 - = f.text_field :danger_color, class: 'color', data: {default: 0xFF0039} - .col-md-6 - = f.text_field :danger_text, class: 'color', data: {default: 0xFFFFFF} - .row - .col-md-6 - = f.text_field :success_color, class: 'color', data: {default: 0x3FB618} - .col-md-6 - = f.text_field :success_text, class: 'color', data: {default: 0xFFFFFF} - .row - .col-md-6 - = f.text_field :warning_color, class: 'color', data: {default: 0xFF7518} - .col-md-6 - = f.text_field :warning_text, class: 'color', data: {default: 0xFFFFFF} - .row - .col-md-6 - = f.text_field :info_color, class: 'color', data: {default: 0x9954BB} - .col-md-6 - = f.text_field :info_text, class: 'color', data: {default: 0xFFFFFF} - .row - .col-md-6 - = f.text_field :default_color, class: 'color', data: {default: 0x222222} - .col-md-6 - = f.text_field :default_text, class: 'color', data: {default: 0xEEEEEE} - .row - .col-md-6 - = f.text_field :panel_color, class: 'color', data: {default: 0xF9F9F9} - .col-md-6 - = f.text_field :panel_text, class: 'color', data: {default: 0x151515} - .row - .col-md-6 - = f.text_field :link_color, class: 'color', data: {default: 0x5E35B1} - .col-md-6 - = f.text_field :background_color, class: 'color', data: {default: 0xFFFFFF} - .row - .col-md-6 - = f.text_field :background_text, class: 'color', data: {default: 0x222222} - .col-md-6 - = f.text_field :background_muted, class: 'color', data: {default: 0xBBBBBB} - .row - .col-md-6 - = f.text_field :input_color, class: 'color', data: {default: 0xFFFFFF} - .col-md-6 - = f.text_field :input_text, class: 'color', data: {default: 0x000000} - .row - .col-md-6 - = f.text_field :outline_color, class: 'color', data: {default: 0x5E35B1} - .col-md-6 - - .pull-left - = f.submit t('views.actions.save'), class: 'btn btn-primary' - - .pull-right - =button_to 'Delete Theme', delete_user_theme_path, data: { confirm: "Are you sure?" }, tabindex: -1, method: :delete, class: "btn btn-danger" diff --git a/app/views/user/export.haml b/app/views/user/export.haml index acbc41ff..bc025d90 100644 --- a/app/views/user/export.haml +++ b/app/views/user/export.haml @@ -1,38 +1,4 @@ += render "settings/export" + - provide(:title, generate_title("Export")) -.container.j2-page - .row - = render 'settings_tabs' - .col-md-9.col-xs-12.col-sm-8 - = render 'layouts/messages' - .card - .card-body - %h2 Export your data - %p - With the announcement of - = succeed ',' do - %a{href: 'http://blog.retrospring.net/saying-goodbye/'} shutting down Retrospring on June 8 2016 - we promised you one last feature: exporting all your data. The data is inside a - %code= ".tar.gz" - archive and available in three formats: YAML, JSON, and XML. The archive also contains a copy of your - profile picture and header picture in all sizes. - %p - Please note that you can only export your data once a week. Exporting your data - will take a while, so please be patient. You will receive a question once exporting - is done. - - if current_user.can_export? - %form{action: begin_user_export_path, method: 'POST'} - %p.centre - %button#export-btn.btn.btn-lg.btn-primary{type: :submit} Export - = hidden_field_tag :authenticity_token, form_authenticity_token - - else - %p.centre - %button.btn.btn-lg.btn-primary.disabled{disabled: :disabled} Export - %p - - if current_user.export_url.nil? - Once exporting your account is done, a download link will appear here. - - else - Here is your export from - = succeed ':' do - = current_user.export_created_at - %a{href: current_user.export_url} - = File.basename current_user.export_url +- parent_layout "user/settings"