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/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/assets/stylesheets/forms.css.scss b/app/assets/stylesheets/forms.css.scss index ebc16a8..ca92105 100644 --- a/app/assets/stylesheets/forms.css.scss +++ b/app/assets/stylesheets/forms.css.scss @@ -16,14 +16,34 @@ 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; + } + + img { + padding: 5px; + display: block; + border: 1px solid #CCC; + background-color: #F1F1F1; + + } + + img+input.image_preview { + margin-left: 12.7em; + } + } -.input textarea { - height: 8em; +.input label.boolean { + margin-left: 12em; } .input .hint, .input .error { @@ -78,3 +98,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; +} diff --git a/app/uploaders/picture_uploader.rb b/app/uploaders/picture_uploader.rb index 217f662..a8c178c 100644 --- a/app/uploaders/picture_uploader.rb +++ b/app/uploaders/picture_uploader.rb @@ -1,9 +1,7 @@ -# encoding: utf-8 - 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: @@ -32,15 +30,15 @@ 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: - # 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. 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) %>
diff --git a/app/views/devise/registrations/edit.html.slim b/app/views/devise/registrations/edit.html.slim index 53d5b36..c3d6161 100644 --- a/app/views/devise/registrations/edit.html.slim +++ b/app/views/devise/registrations/edit.html.slim @@ -1,10 +1,10 @@ -= 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 :first_name + = 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 = 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/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 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' 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/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/_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' 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' 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" } diff --git a/spec/support/picture.jpg b/spec/support/picture.jpg index e69de29..f0840bf 100644 Binary files a/spec/support/picture.jpg and b/spec/support/picture.jpg differ