Skip to content
This repository has been archived by the owner on May 18, 2021. It is now read-only.

Commit

Permalink
Merge branch 'feature/215-afterpartyntshirts' into develop
Browse files Browse the repository at this point in the history
  • Loading branch information
dvislov committed Mar 22, 2013
2 parents 3f0a678 + 6b43073 commit 667813f
Show file tree
Hide file tree
Showing 15 changed files with 131 additions and 71 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ class Web::Account::AfterpartyOrdersController < Web::Account::ApplicationContro
def new
@afterparty_order = AfterpartyOrder.new
gon.price = configus.platidoma.afterparty_price
@count_paid_afterparty = AfterpartyOrder.paid.count + User.as_lectors.count
end

def create
Expand Down
6 changes: 4 additions & 2 deletions app/models/shirt_order.rb
Original file line number Diff line number Diff line change
@@ -1,15 +1,17 @@
class ShirtOrder < Order
extend Enumerize

attr_accessible :item_size
attr_accessible :item_size, :item_color

validates :item_size, presence: true
validates :item_color, presence: true

enumerize :item_size, in: [:S, :M, :L, :XL]
enumerize :item_color, in: [:white, :red]

#FIXME найти другой вариант реализации перевода
def to_s
"#{I18n.t("activerecord.models.shirt_order")} (#{item_size})"
"#{I18n.t("activerecord.models.shirt_order")} (#{item_size}, #{item_color})"
end

def cost
Expand Down
1 change: 1 addition & 0 deletions app/repositories/order_repository.rb
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ module OrderRepository

included do
scope :web, -> { by_created_at }
scope :paid, -> { where(payment_state: :paid) }
end

end
2 changes: 1 addition & 1 deletion app/views/layouts/web/shared/_navbar.html.haml
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@

%ul.nav.pull-left
%li= link_to t('.stachka_2012'), 'http://2012.nastachku.ru', class: 'btn-shine add_lecture prev_year', target: "_blank"
%li= link_to t('.buy'), new_account_afterparty_order_path, class: 'btn-shine btn-shine-colored add_lecture prev_year'
%li= link_to t('.buy'), new_account_shirt_order_path, class: 'btn-shine btn-shine-colored add_lecture prev_year'
%li= link_to t('.add_lecture'), new_account_lecture_path, class: 'btn-shine add_lecture'

%ul.nav.pull-right
Expand Down
75 changes: 41 additions & 34 deletions app/views/web/account/afterparty_orders/new.html.haml
Original file line number Diff line number Diff line change
@@ -1,44 +1,51 @@
.page-header
%h1=t '.afterparty'

%h1=t '.afterparty'
.row
.span9
%p
=t '.afterparty_content_part_1'
%span.color «
= link_to t(".duke"), "http://dukeclub.ru/", :target => "_blank"
%span.color ».
=t '.afterparty_content_part_2'
%p
= t '.afterparty_content_part_3'

%p
=t '.afterparty_content_part_1'
%span.color «
= link_to t(".duke"), "http://dukeclub.ru/", :target => "_blank"
%span.color ».
=t '.afterparty_content_part_2'
%br
%h5
%span.color
= @count_paid_afterparty
= t (".participants_count")

.tabbable
%ul.nav.nav-tabs
%li.active= link_to t('.afterparty'), new_account_afterparty_order_path
%li= link_to t('.shirt'), new_account_shirt_order_path
.span3.center
%p
= link_to t(".tshirt_motivate_link"), new_account_shirt_order_path
= link_to new_account_shirt_order_path do
%img{:src => "/images/tshirt_1.png", :width => 233, :height => 253, :alt => "Футболка"}
%br

= simple_form_for [:account, @afterparty_order], :html => { :class => 'form-horizontal profile-form' } do |f|
.formy
.control-group
%label.control-label.center
.row-fluid
.span3.center
= t(".item_name")
.controls
.row-fluid
.span4.center
= t(".item_count")
.span4.center
= t(".item_cost_title")
.span4.center
= t(".item_total_title")
.control-group
%label.control-label.center
.span3.center
= t(".item_count")
.span3.center
= t(".item_cost_title")
.span3.center
= t(".item_total_title")
%br
.row-fluid
.span3.center
= t(".enter_ticket")
.controls
.row-fluid
.span4.center
= f.input_field :items_count, collection: 1..10, default: 0, class: "items-count-select input-mini"
.span4.center
= t(".item_cost_value")
.span4.center
%big
.cost
= t(".item_total_default")
.span3.center
= f.input_field :items_count, collection: 1..10, default: 0, class: "items-count-select input-mini"
.span3.center
= t(".item_cost_value")
.span3.center
%big
.cost
= t(".item_total_default")

= f.button :submit, :value => t('.buy'), :class => 'btn btn-shine'
82 changes: 50 additions & 32 deletions app/views/web/account/shirt_orders/new.html.haml
Original file line number Diff line number Diff line change
@@ -1,40 +1,58 @@
.page-header
%h1=t '.add_order'
%h1=t '.buy_tshirt'

.tabbable
%ul.nav.nav-tabs
%li= link_to t('.afterparty'), new_account_afterparty_order_path
%li.active= link_to t('.shirt'), new_account_shirt_order_path
%p
= t('.tshirt_promo')
%br
= t('.thisrt_promo_ps')
= t('.buy_afterparty_ticket_before')
= link_to t('.buy_afterparty_ticket_action'), new_account_afterparty_order_path
= t('.buy_afterparty_ticket_after')
%br

.row-fluid
.span3.left
%img{:src => "/images/tshirt_1.png", :width => 233, :height => 253, :alt => "Футболка"}
.span3.center
%img{:src => "/images/tshirt_2.png", :width => 233, :height => 253, :alt => "Футболка"}
.span3.center
%img{:src => "/images/tshirt_3.png", :width => 233, :height => 253, :alt => "Футболка"}
.span3.right
%img{:src => "/images/tshirt_4.png", :width => 233, :height => 253, :alt => "Футболка"}

%br

= simple_form_for [:account, @shirt_order], :html => { :class => 'form-horizontal profile-form' } do |f|
.formy
.control-group
%label.control-label.center
.row-fluid
.span2.center
= t(".item_name")
.controls
.row-fluid
.span2.center
= t(".item_size")
.span3.center
= t(".item_count")
.span4.center
= t(".item_cost_title")
.span3.center
= t(".item_total_title")
.control-group
%label.control-label.center
.span1.center
= t(".item_size")
.span2.center
= t(".item_color")
.span2.center
= t(".item_count")
.span3.center
= t(".item_cost_title")
.span2.center
= t(".item_total_title")

%br

.row-fluid
.span2.center
= t(".t_shirt")
.controls
.row-fluid
.span2.center
= f.input_field :item_size, collection: ShirtOrder.item_size.options, default: 0, class: "input-mini"
.span3.center
= f.input_field :items_count, collection: 1..10, default: 0, class: "items-count-select input-mini"
.span4.center
= t(".item_cost_value")
.span3.center
%big
.cost
= t(".item_total_default")
.span1.center
= f.input_field :item_size, collection: ShirtOrder.item_size.options, default: 0, class: "input-mini"
.span2.center
= f.input_field :item_color, collection: ShirtOrder.item_color.options, default: 0, class: "input-small"
.span2.center
= f.input_field :items_count, collection: 1..10, default: 0, class: "items-count-select input-mini"
.span3.center
= t(".item_cost_value")
.span2.center
%big
.cost
= t(".item_total_default")

= f.button :submit, :value => t('.buy'), :class => 'btn btn-shine'
16 changes: 15 additions & 1 deletion config/locales/ru.yml
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ ru:
admin: 'Админка'
add_lecture: 'Добавить доклад'
stachka_2012: 'Стачка! 2012'
buy: "Купить"
buy: "Купить футболку"

admin:
shared:
Expand Down Expand Up @@ -100,16 +100,21 @@ ru:
item_total_default: "1500 руб."
afterparty_content_part_1: "Отдохнуть после насыщенного Стачко-дня, поделиться впечатлениями от докладов, потусоваться и пообщаться со спикерами и лучшими людьми сферы в неформальной обстановке? Добро пожаловать на афтепати «Стачки!» 12 апреля в 19.00 ждем вас в кафе-клубе"
afterparty_content_part_2: "Успейте попасть на закрытую вечеринку, количество билетов ограничено."
afterparty_content_part_3: "P.S.: Билеты найдут своих законных обладателей в день конференции - 12 апреля."
participants_count: "человек уже идут с нами. Не отставай!"
tshirt_motivate_link: "Хочешь быть в тренде? Жми!"
create:
title: "Оформить заказ на афтепати"

shirt_orders:
new:
title: "Оформить заказ на футболку"
buy: "Купить"
buy_tshirt: "Купить футболку"
afterparty: "Афтепати"
shirt: "Футболка"
add_order: "Оформить заказ"
item_color: "Цвет"
item_name: "Наименование"
item_count: "Количество"
item_cost_title: "Стоимость 1 футболки"
Expand All @@ -119,6 +124,11 @@ ru:
item_total_default: "500 руб."
item_size: "Размер"
t_shirt: "Футболка"
tshirt_promo: "Отхвати себе кусочек Стачко-стиля и будь в тренде! Дело за малым – жми на заказ и приобщайся к нашему движению. Фирменная футболка «Стачки!» уже готова прыгнуть в твой гардероб."
thisrt_promo_ps: " P.S.: Ты получишь ее в день конференции – 12 апреля. До встречи в Ленинском Мемориале!"
buy_afterparty_ticket_before: "И не забудь"
buy_afterparty_ticket_after: "билет на афтепати! ;)"
buy_afterparty_ticket_action: "купить"

users:
form:
Expand Down Expand Up @@ -557,3 +567,7 @@ ru:
M: "M"
L: "L"
XL: "XL"

item_color:
white: "Белый"
red: "Красный"
5 changes: 5 additions & 0 deletions db/migrate/20130322110701_add_color_field_to_order.rb
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
class AddColorFieldToOrder < ActiveRecord::Migration
def change
add_column :orders, :item_color, :string
end
end
10 changes: 10 additions & 0 deletions db/migrate/20130322112003_update_default_order_item_color.rb
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
class UpdateDefaultOrderItemColor < ActiveRecord::Migration
def up
Order.reset_column_information
Order.update_all({:item_color => :white}, :item_color => nil)
end

def down
Order.update_all(:item_color => :white)
end
end
3 changes: 2 additions & 1 deletion db/schema.rb
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@
#
# It's strongly recommended to check this file into your version control system.

ActiveRecord::Schema.define(:version => 20130320131032) do
ActiveRecord::Schema.define(:version => 20130322112003) do

create_table "audits", :force => true do |t|
t.integer "auditable_id"
Expand Down Expand Up @@ -112,6 +112,7 @@
t.string "transaction_id"
t.datetime "created_at", :null => false
t.datetime "updated_at", :null => false
t.string "item_color"
end

create_table "pages", :force => true do |t|
Expand Down
Binary file added public/images/tshirt_1.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added public/images/tshirt_2.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added public/images/tshirt_3.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added public/images/tshirt_4.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
1 change: 1 addition & 0 deletions test/factories/shirt_orders.rb
Original file line number Diff line number Diff line change
Expand Up @@ -5,5 +5,6 @@
user
items_count
item_size "L"
item_color "white"
end
end

0 comments on commit 667813f

Please sign in to comment.