From f849111614792bcb40094a09b56b1b5145429b3e Mon Sep 17 00:00:00 2001 From: Petko Bordjukov Date: Sun, 31 Aug 2014 18:07:17 +0300 Subject: [PATCH 1/9] Remove HTML versions of Devise emails --- .../devise/mailer/confirmation_instructions.html.erb | 5 ----- .../devise/mailer/reset_password_instructions.html.erb | 8 -------- .../devise/mailer/reset_password_instructions.text.erb | 2 +- app/views/devise/mailer/unlock_instructions.html.erb | 7 ------- 4 files changed, 1 insertion(+), 21 deletions(-) delete mode 100644 app/views/devise/mailer/confirmation_instructions.html.erb delete mode 100644 app/views/devise/mailer/reset_password_instructions.html.erb delete mode 100644 app/views/devise/mailer/unlock_instructions.html.erb diff --git a/app/views/devise/mailer/confirmation_instructions.html.erb b/app/views/devise/mailer/confirmation_instructions.html.erb deleted file mode 100644 index 879307d..0000000 --- a/app/views/devise/mailer/confirmation_instructions.html.erb +++ /dev/null @@ -1,5 +0,0 @@ -

Добре дошли, <%= @email %>!

- -

Можете да потвърдите акаунта си като кликнете на линка отдолу:

- -

<%= link_to 'Потвърди акаунта ми', confirmation_url(@resource, confirmation_token: @token) %>

diff --git a/app/views/devise/mailer/reset_password_instructions.html.erb b/app/views/devise/mailer/reset_password_instructions.html.erb deleted file mode 100644 index 387dcaa..0000000 --- a/app/views/devise/mailer/reset_password_instructions.html.erb +++ /dev/null @@ -1,8 +0,0 @@ -

Здравейте, <%= @resource.email %>!

- -

Някой поиска линк за промяна на парола на аканута Ви. Паролата може да бъде променена от линкът отдолу.

- -

<%= link_to 'Промяна на парола', edit_password_url(@resource, reset_password_token: @token) %>

- -

Ако не желаете да смените паролата си, моля изтрийте това писмо.

-

Паролата Ви няма да бъде променена докато не кликнете горния линк и не въведете нова парола.

diff --git a/app/views/devise/mailer/reset_password_instructions.text.erb b/app/views/devise/mailer/reset_password_instructions.text.erb index 5264935..2caeadd 100644 --- a/app/views/devise/mailer/reset_password_instructions.text.erb +++ b/app/views/devise/mailer/reset_password_instructions.text.erb @@ -1,4 +1,4 @@ ->Здравейте, <%= @resource.email %>! +Здравейте, <%= @resource.email %>! Някой поиска линк за промяна на парола на аканута Ви. Паролата може да бъде променена от линкът отдолу. diff --git a/app/views/devise/mailer/unlock_instructions.html.erb b/app/views/devise/mailer/unlock_instructions.html.erb deleted file mode 100644 index 145011d..0000000 --- a/app/views/devise/mailer/unlock_instructions.html.erb +++ /dev/null @@ -1,7 +0,0 @@ -

Здравейте, <%= @resource.email %>!

- -

Акаунтът Ви беше заключен поради голям брой неуспешни опити за влизане в него.

- -

Кликнете линкът отдолу, за да го отключите:

- -

<%= link_to 'Отключване на акаунт', unlock_url(@resource, unlock_token: @token) %>

From 99e08ff204b029a497650dfcd4a5c6d5d446ef4e Mon Sep 17 00:00:00 2001 From: Petko Bordjukov Date: Sun, 31 Aug 2014 18:03:28 +0300 Subject: [PATCH 2/9] Allow only jp(e)g and png uploads --- app/uploaders/picture_uploader.rb | 8 +++----- 1 file changed, 3 insertions(+), 5 deletions(-) diff --git a/app/uploaders/picture_uploader.rb b/app/uploaders/picture_uploader.rb index 217f662..0b0d0f2 100644 --- a/app/uploaders/picture_uploader.rb +++ b/app/uploaders/picture_uploader.rb @@ -1,5 +1,3 @@ -# encoding: utf-8 - class PictureUploader < CarrierWave::Uploader::Base # Include RMagick or MiniMagick support: @@ -38,9 +36,9 @@ class PictureUploader < CarrierWave::Uploader::Base # Add a white list of extensions which are allowed to be uploaded. # For images you might use something like this: - # def extension_white_list - # %w(jpg jpeg gif png) - # end + def extension_white_list + %w(jpg jpeg png) + end # Override the filename of the uploaded files: # Avoid using model.id or version_name here, see uploader/store.rb for details. From 673c1de4a0016a21dfaf9505e6b70f89f66e4807 Mon Sep 17 00:00:00 2001 From: Petko Bordjukov Date: Sun, 31 Aug 2014 18:31:50 +0300 Subject: [PATCH 3/9] Tweak styles of buttons on home page --- app/assets/stylesheets/forms.css.scss | 40 +++++++++++++++++++++++++++ app/views/home/index.html.slim | 7 ++--- 2 files changed, 43 insertions(+), 4 deletions(-) diff --git a/app/assets/stylesheets/forms.css.scss b/app/assets/stylesheets/forms.css.scss index ebc16a8..99199a3 100644 --- a/app/assets/stylesheets/forms.css.scss +++ b/app/assets/stylesheets/forms.css.scss @@ -78,3 +78,43 @@ transform: translate(0, 0.1em); -webkit-transform: translate(0, 0.1em); } + +.centered { + text-align: center; +} + +.large { + padding: 30px; +} + +.btn-link { + background: #233e83; + padding: 0.4em 0.8em; + border-radius: 0.2em; + color: #FFF; + border: none; + border-bottom: 0.2em solid #7A95DC; + cursor: pointer; + transition: background 200ms, border 200ms, transform 200ms; + -webkit-transition: background 200ms, border 200ms, transform 200ms; +} + +.btn-link:link, .btn-link:active, .btn-link:visited { + color: #FFF; + text-decoration: none; +} + +.btn-link:hover { + background: #152551; +} + +.btn-link:active { + background: #597AD2; + border-bottom: 0.2em solid #000; + transform: translate(0, 0.1em); + -webkit-transform: translate(0, 0.1em); +} + +.btn-link-large { + font-size: 2em; +} \ No newline at end of file diff --git a/app/views/home/index.html.slim b/app/views/home/index.html.slim index ad83144..ef351a3 100644 --- a/app/views/home/index.html.slim +++ b/app/views/home/index.html.slim @@ -9,7 +9,6 @@ ul - for track in @current_conference.tracks li = track.name -.centered - = link_to 'Предложи лекция', new_lecture_path - - = link_to 'Предложи уъркшоп', new_workshop_path +.centered.large + => link_to 'Предложи лекция', new_lecture_path, class: 'btn-link btn-link-large' + = link_to 'Предложи уъркшоп', new_workshop_path, class: 'btn-link btn-link-large' From 2562055206cca5d4678207b25a566a2efbf900f3 Mon Sep 17 00:00:00 2001 From: Petko Bordjukov Date: Sun, 31 Aug 2014 18:48:53 +0300 Subject: [PATCH 4/9] More CSS tweaks --- app/assets/stylesheets/forms.css.scss | 22 +++++++++++++++------- app/views/devise/sessions/new.html.slim | 2 +- 2 files changed, 16 insertions(+), 8 deletions(-) diff --git a/app/assets/stylesheets/forms.css.scss b/app/assets/stylesheets/forms.css.scss index 99199a3..167ea32 100644 --- a/app/assets/stylesheets/forms.css.scss +++ b/app/assets/stylesheets/forms.css.scss @@ -16,14 +16,22 @@ float: left; } -.input input, .input textarea, .input select { - font-size: 1em; - width: 20em; - float: left; +.input { + input.string, input.email, input.password, select.select, input.numeric { + font-size: 1em; + width: 20em; + float: left; + } + + textarea { + height: 15em; + width: 50em; + } + } -.input textarea { - height: 8em; +.input label.boolean { + margin-left: 12em; } .input .hint, .input .error { @@ -117,4 +125,4 @@ .btn-link-large { font-size: 2em; -} \ No newline at end of file +} diff --git a/app/views/devise/sessions/new.html.slim b/app/views/devise/sessions/new.html.slim index 996b085..fc125ce 100644 --- a/app/views/devise/sessions/new.html.slim +++ b/app/views/devise/sessions/new.html.slim @@ -1,6 +1,6 @@ h2.entry-title Вход -= simple_form_for(resource, as: resource_name, url: session_path(resource_name)) do |f| += simple_form_for(resource, as: resource_name, url: session_path(resource_name), ) do |f| .form-inputs = f.input :email, required: false, autofocus: true, hint: false = f.input :password, required: false, hint: false From da666d11d0fda1cfc6d09586468534f11eaefc9f Mon Sep 17 00:00:00 2001 From: Petko Bordjukov Date: Sun, 31 Aug 2014 18:58:07 +0300 Subject: [PATCH 5/9] Front-end tweaks --- app/views/devise/registrations/edit.html.slim | 4 ++-- app/views/lectures/_lecture.html.slim | 1 + app/views/lectures/index.html.slim | 10 ++++++---- app/views/workshops/_workshop.html.slim | 1 + app/views/workshops/index.html.slim | 10 ++++++---- 5 files changed, 16 insertions(+), 10 deletions(-) create mode 100644 app/views/lectures/_lecture.html.slim create mode 100644 app/views/workshops/_workshop.html.slim diff --git a/app/views/devise/registrations/edit.html.slim b/app/views/devise/registrations/edit.html.slim index 53d5b36..ab3bae9 100644 --- a/app/views/devise/registrations/edit.html.slim +++ b/app/views/devise/registrations/edit.html.slim @@ -4,7 +4,7 @@ = f.error_notification = f.simple_fields_for :speaker_profile do |ff| = ff.input :picture, as: :file - = ff.input :first_name + = ff.input :first_name, autofocus: true = ff.input :last_name = ff.input :public_email = ff.input :organisation @@ -15,7 +15,7 @@ .form-inputs h3.entry-title Данни за вход в системата - = f.input :email, required: true, autofocus: true + = f.input :email, required: true - if devise_mapping.confirmable? && resource.pending_reconfirmation? p diff --git a/app/views/lectures/_lecture.html.slim b/app/views/lectures/_lecture.html.slim new file mode 100644 index 0000000..9e580ad --- /dev/null +++ b/app/views/lectures/_lecture.html.slim @@ -0,0 +1 @@ +li = link_to lecture.title, lecture diff --git a/app/views/lectures/index.html.slim b/app/views/lectures/index.html.slim index 3324930..f946ee3 100644 --- a/app/views/lectures/index.html.slim +++ b/app/views/lectures/index.html.slim @@ -1,7 +1,9 @@ h1.entry-title Моите предложения за лекции -ul - - for lecture in @lectures - li = link_to lecture.title, lecture +- unless @lectures.empty? + ul + = render @lectures +- else + p Все още не Сте предложили лекция -= link_to 'Предложи лекция', new_lecture_path += link_to 'Предложи лекция', new_lecture_path, class: 'btn-link' diff --git a/app/views/workshops/_workshop.html.slim b/app/views/workshops/_workshop.html.slim new file mode 100644 index 0000000..f4fa390 --- /dev/null +++ b/app/views/workshops/_workshop.html.slim @@ -0,0 +1 @@ +li = link_to workshop.title, workshop diff --git a/app/views/workshops/index.html.slim b/app/views/workshops/index.html.slim index b9ba7be..e4c1dba 100644 --- a/app/views/workshops/index.html.slim +++ b/app/views/workshops/index.html.slim @@ -1,7 +1,9 @@ h1.entry-title Моите предложения за уъркшопи -ul - - for workshop in @workshops - li = link_to workshop.title, workshop +- unless @workshops.empty? + ul + = render @workshops +- else + p Все още не Сте предложили уъркшоп -= link_to 'Предложи уъркшоп', new_workshop_path += link_to 'Предложи уъркшоп', new_workshop_path, class: 'btn-link' From 09b737264f7f3331df0528b0a51f57377a41694c Mon Sep 17 00:00:00 2001 From: Petko Bordjukov Date: Sun, 31 Aug 2014 19:29:19 +0300 Subject: [PATCH 6/9] Add preview image in the User edit form --- Gemfile | 2 ++ Gemfile.lock | 12 ++++++++++++ app/assets/stylesheets/forms.css.scss | 12 ++++++++++++ app/uploaders/picture_uploader.rb | 8 ++++---- app/views/devise/registrations/edit.html.slim | 4 ++-- 5 files changed, 32 insertions(+), 6 deletions(-) diff --git a/Gemfile b/Gemfile index e9a722f..c6ea706 100644 --- a/Gemfile +++ b/Gemfile @@ -20,12 +20,14 @@ gem 'devise' gem 'devise-i18n' gem 'simple_form' +gem 'simple_form_fancy_uploads', github: 'apeacox/simple_form_fancy_uploads' # Phone validation gem 'phony_rails' # Picture uploads gem 'carrierwave' +gem 'rmagick' gem 'capistrano' gem 'capistrano-rails' diff --git a/Gemfile.lock b/Gemfile.lock index 4ea08c7..86af20e 100644 --- a/Gemfile.lock +++ b/Gemfile.lock @@ -1,3 +1,12 @@ +GIT + remote: git://github.com/apeacox/simple_form_fancy_uploads.git + revision: a135aad8f17cbf219a30ce5a30709406e277f7e0 + specs: + simple_form_fancy_uploads (0.1.0) + carrierwave + rails (>= 4.0.0) + simple_form (~> 3.0) + GEM remote: https://rubygems.org/ specs: @@ -167,6 +176,7 @@ GEM rb-inotify (0.9.5) ffi (>= 0.5.0) ref (1.0.5) + rmagick (2.13.3) rspec (3.0.0) rspec-core (~> 3.0.0) rspec-expectations (~> 3.0.0) @@ -266,9 +276,11 @@ DEPENDENCIES rails (= 4.1.5) rails-erd rails-i18n + rmagick rspec-rails sass-rails (~> 4.0.3) simple_form + simple_form_fancy_uploads! slim-rails spring spring-commands-rspec diff --git a/app/assets/stylesheets/forms.css.scss b/app/assets/stylesheets/forms.css.scss index 167ea32..ca92105 100644 --- a/app/assets/stylesheets/forms.css.scss +++ b/app/assets/stylesheets/forms.css.scss @@ -28,6 +28,18 @@ width: 50em; } + img { + padding: 5px; + display: block; + border: 1px solid #CCC; + background-color: #F1F1F1; + + } + + img+input.image_preview { + margin-left: 12.7em; + } + } .input label.boolean { diff --git a/app/uploaders/picture_uploader.rb b/app/uploaders/picture_uploader.rb index 0b0d0f2..a8c178c 100644 --- a/app/uploaders/picture_uploader.rb +++ b/app/uploaders/picture_uploader.rb @@ -1,7 +1,7 @@ class PictureUploader < CarrierWave::Uploader::Base # Include RMagick or MiniMagick support: - # include CarrierWave::RMagick + include CarrierWave::RMagick # include CarrierWave::MiniMagick # Choose what kind of storage to use for this uploader: @@ -30,9 +30,9 @@ class PictureUploader < CarrierWave::Uploader::Base # end # Create different versions of your uploaded files: - # version :thumb do - # process :resize_to_fit => [50, 50] - # end + version :thumb do + process :resize_to_fit => [50, 50] + end # Add a white list of extensions which are allowed to be uploaded. # For images you might use something like this: diff --git a/app/views/devise/registrations/edit.html.slim b/app/views/devise/registrations/edit.html.slim index ab3bae9..c3d6161 100644 --- a/app/views/devise/registrations/edit.html.slim +++ b/app/views/devise/registrations/edit.html.slim @@ -1,9 +1,9 @@ -= simple_form_for(resource, as: resource_name, url: registration_path(resource_name), html: { method: :put }) do |f| += simple_form_for(resource, as: resource_name, url: registration_path(resource_name), html: { method: :put, multipart: true }) do |f| .form_inputs h2.entry-title Лекторски профил = f.error_notification = f.simple_fields_for :speaker_profile do |ff| - = ff.input :picture, as: :file + = ff.input :picture, as: :image_preview, input_html: {preview_version: :thumb} = ff.input :first_name, autofocus: true = ff.input :last_name = ff.input :public_email From ddc956f3bad00ff9717cfc6c6319294baab301a3 Mon Sep 17 00:00:00 2001 From: Petko Bordjukov Date: Sun, 31 Aug 2014 20:15:29 +0300 Subject: [PATCH 7/9] Fix spec failure --- spec/support/picture.jpg | Bin 0 -> 974 bytes 1 file changed, 0 insertions(+), 0 deletions(-) diff --git a/spec/support/picture.jpg b/spec/support/picture.jpg index e69de29bb2d1d6434b8b29ae775ad8c2e48c5391..f0840bf803285338d4779dd14f9029da7d341e5f 100644 GIT binary patch literal 974 zcmex=N z4?hnVHy<}AC$AtcAHRTrpa2(-kg$+|Fpw?q{{RCw2g5XmX^f154F8WXNCQn~W?%*y z4+qRFtc*--96(830S2H&jLgi8?5t2}Mkb)NAe)e)p<|#hyNHreBMaDW~Zgo)YH>Bi*7%@e5h_uQP}cTC6&^gSuan| z`IMNmVoIo3!E*V~ySHz@{p6h=@G|4(asRwSJD&M2S)KW7zsr3YwZD^VHoJ&yo86l> zt99b$Gpz!X-}c*VSN|~S(|?8}-s!=arILXM&!3*6KQ-$r$HkQU$+^WplKx({ezW~o zt!rrP#P>?f4lRi$r8r?>y@1y525iPr;AJ z-;JuY(>L9H{q|0Js$0N``MD-;hF(+U`KRsKc7MM8@{{bh)WlThnopf;Q}uLW&?h|gEvSVhC zef?G~&It|tFlAEgo{uVfette}b^Vgnu5E@l-0m!wi2Ib-^Y%|i)Zetl$J?L&{-FO- zH_YwgTb+4M?>32_myJAX7AgO7&f??Ke}BlxExr17>-X1r`(9GbR1@`6;vg zuU6FAN^56V)e8sDu8ZUSDX{A6bMd{k5~n-XJ(aWc|M2Jc=Dr0lUs-i^Bt1=kcG0Ku zU7Kx})_Ki!PcA=i7d;qnzofuSZ)fc6`I2iY9>-d}dppfH`__5+?)&HagJRcvzuq?S zxZjzc$mFn>Eg#psnSMFDo&DiwIbI!~m>QX=4Ii^ZFZ+lnioTg>KypfkYmonc69D44 Bfw2Gp literal 0 HcmV?d00001 From 2535429b85d4ee491f13cea07e1af481dd86b2d8 Mon Sep 17 00:00:00 2001 From: Petko Bordjukov Date: Sun, 31 Aug 2014 20:16:21 +0300 Subject: [PATCH 8/9] Styling of Lectures and Workshops show views --- app/assets/stylesheets/events.css.scss | 36 ++++++++++++++++++++++++++ app/views/lectures/show.html.slim | 14 +++++----- app/views/workshops/show.html.slim | 12 ++++----- 3 files changed, 47 insertions(+), 15 deletions(-) create mode 100644 app/assets/stylesheets/events.css.scss diff --git a/app/assets/stylesheets/events.css.scss b/app/assets/stylesheets/events.css.scss new file mode 100644 index 0000000..dc6fdeb --- /dev/null +++ b/app/assets/stylesheets/events.css.scss @@ -0,0 +1,36 @@ +.lecture-title { + font-family: Arial,sans-serif; + font-size: 26px; + font-weight: bold; + line-height: 26px; + padding: 0px 0px 7px; + font-style: italic; + + span.subtitle { + font-size: 18px; + font-style: italic; + color: #999; + } +} + +.abstract, .description { + h3 { + font-family: Arial,sans-serif; + margin-top: 14px; + font-size: 21px; + font-style: italic; + font-weight: bold; + } + + p { + text-indent: 10px; + margin-top: 0px; + margin-bottom: 0px; + padding: 0; + width: 600px; + } + + p:last-of-type { + margin-bottom: 15px; + } +} \ No newline at end of file diff --git a/app/views/lectures/show.html.slim b/app/views/lectures/show.html.slim index 89ab7ef..04fb996 100644 --- a/app/views/lectures/show.html.slim +++ b/app/views/lectures/show.html.slim @@ -1,12 +1,10 @@ -h1.entry-title Преглед на лекция - h2.lecture-title - = @lecture.title + => @lecture.title span.subtitle = @lecture.subtitle - .entry-meta - | - поток: „#{@lecture.track.name}“, - продължителност: #{@lecture.length} мин. +.entry-meta + | + поток: „#{@lecture.track.name}“, + продължителност: #{@lecture.length} мин. section.abstract h3 Резюме @@ -17,4 +15,4 @@ section.description = simple_format @lecture.description - if current_user == @lecture.user - = link_to 'Редактирай', edit_lecture_path(@lecture) + = link_to 'Редактирай', edit_lecture_path(@lecture), class: 'btn-link' diff --git a/app/views/workshops/show.html.slim b/app/views/workshops/show.html.slim index 6cbdf39..dc26192 100644 --- a/app/views/workshops/show.html.slim +++ b/app/views/workshops/show.html.slim @@ -1,12 +1,10 @@ -h1.entry-title Преглед на уъркшоп - h2.workshop-title = @workshop.title span.subtitle = @workshop.subtitle - .entry-meta - | - поток: „#{@workshop.track.name}“, - продължителност: #{@workshop.length} мин. +.entry-meta + | + поток: „#{@workshop.track.name}“, + продължителност: #{@workshop.length} мин. section.abstract h3 Резюме @@ -17,4 +15,4 @@ section.description = simple_format @workshop.description - if current_user == @workshop.user - = link_to 'Редактирай', edit_workshop_path(@workshop) + = link_to 'Редактирай', edit_workshop_path(@workshop), class: 'btn-link' From a6617c1407c0e0c87f2a85c7ba67e54a5642e03c Mon Sep 17 00:00:00 2001 From: Petko Bordjukov Date: Sun, 31 Aug 2014 20:19:21 +0300 Subject: [PATCH 9/9] Add public/uploads to the shared directories --- config/deploy.rb | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/config/deploy.rb b/config/deploy.rb index dd3e111..f3547de 100644 --- a/config/deploy.rb +++ b/config/deploy.rb @@ -26,7 +26,7 @@ set :deploy_to, '/home/barf/clarion' set :linked_files, %w{config/puma.rb config/database.yml config/secrets.yml} # Default value for linked_dirs is [] -set :linked_dirs, %w{bin log tmp/pids tmp/cache tmp/sockets vendor/bundle public/system} +set :linked_dirs, %w{bin log tmp/pids tmp/cache tmp/sockets vendor/bundle public/system public/uploads} # Default value for default_env is {} # set :default_env, { path: "/opt/ruby/bin:$PATH" }