mirror of
https://github.com/internetee/registry.git
synced 2025-07-20 01:36:02 +02:00
Merge branch 'master' of github.com:domify/registry
This commit is contained in:
commit
ac886fb4cb
8 changed files with 64 additions and 52 deletions
|
@ -39,6 +39,7 @@ class Admin::PricelistsController < AdminController
|
|||
end
|
||||
|
||||
def pricelist_params
|
||||
params.require(:pricelist).permit(:category, :name, :duration, :price, :valid_from, :valid_to)
|
||||
params.require(:pricelist).permit(:operation_category, :category, :price_category,
|
||||
:duration, :price, :valid_from, :valid_to)
|
||||
end
|
||||
end
|
||||
|
|
|
@ -3,9 +3,11 @@ class Pricelist < ActiveRecord::Base
|
|||
|
||||
monetize :price_cents
|
||||
|
||||
validates :price_cents, :price_currency, :valid_from, :category, presence: true
|
||||
validates :price_cents, :price_currency, :price,
|
||||
:valid_from, :category, :operation_category, :duration, presence: true
|
||||
|
||||
CATEGORIES = %w(ee com.ee fie.ee pri.ee med.ee)
|
||||
CATEGORIES = %w(ee pri.ee fie.ee med.ee com.ee)
|
||||
OPERATION_CATEGORIES = %w(new renew)
|
||||
DURATIONS = %w(1year 2years 3years)
|
||||
|
||||
after_initialize :init_values
|
||||
|
@ -13,4 +15,8 @@ class Pricelist < ActiveRecord::Base
|
|||
return unless new_record?
|
||||
self.valid_from = Time.zone.now.beginning_of_year
|
||||
end
|
||||
|
||||
def name
|
||||
"#{operation_category} #{category}"
|
||||
end
|
||||
end
|
||||
|
|
|
@ -3,12 +3,12 @@
|
|||
|
||||
.row
|
||||
.col-md-6
|
||||
.form-group
|
||||
= f.label :operation_category
|
||||
= f.select(:operation_category, Pricelist::OPERATION_CATEGORIES, {}, { class: 'form-control' })
|
||||
.form-group
|
||||
= f.label :category, t(:category)
|
||||
= f.select(:category, Pricelist::CATEGORIES, {}, { class: 'form-control' })
|
||||
.form-group
|
||||
= f.label :name
|
||||
= f.text_field(:name, class: 'form-control')
|
||||
.form-group
|
||||
= f.label :duration
|
||||
= f.select(:duration, Pricelist::DURATIONS, {}, { class: 'form-control' })
|
||||
|
|
|
@ -5,20 +5,6 @@
|
|||
%h2.text-right.text-center-xs
|
||||
= link_to(t(:new), new_admin_pricelist_path, class: 'btn btn-primary')
|
||||
|
||||
%hr
|
||||
-# .row
|
||||
-# .col-md-12
|
||||
-# = form_tag admin_pricelists_path, html: { class: 'form-horizontal' } do
|
||||
-# .col-md-11
|
||||
-# .form-group
|
||||
-# = search_field_tag :name_cont, class: 'form-control'
|
||||
-# .col-md-1.text-right.text-center-xs
|
||||
-# .form-group
|
||||
-# %button.btn.btn-primary
|
||||
-#
|
||||
-# %span.glyphicon.glyphicon-search
|
||||
-#
|
||||
|
||||
%hr
|
||||
.row
|
||||
.col-md-12
|
||||
|
@ -29,9 +15,9 @@
|
|||
%th{class: 'col-xs-2'}
|
||||
= sort_link(@q, 'category', t(:category))
|
||||
%th{class: 'col-xs-2'}
|
||||
= sort_link(@q, 'duration', t(:duration))
|
||||
= sort_link(@q, 'operation_category', t(:operation))
|
||||
%th{class: 'col-xs-2'}
|
||||
= sort_link(@q, 'name', t(:name))
|
||||
= sort_link(@q, 'duration', t(:duration))
|
||||
%th{class: 'col-xs-2'}
|
||||
= sort_link(@q, 'price', t(:price))
|
||||
%th{class: 'col-xs-2'}
|
||||
|
@ -45,8 +31,8 @@
|
|||
- @pricelists.each do |pricelist|
|
||||
%tr
|
||||
%td= pricelist.category
|
||||
%td= pricelist.operation_category
|
||||
%td= pricelist.duration
|
||||
%td= pricelist.name
|
||||
%td= pricelist.price
|
||||
%td= l(pricelist.valid_from, format: :ydate)
|
||||
%td= l(pricelist.valid_to, format: :ydate)
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue