layout changes and section handling

This commit is contained in:
2012-09-02 14:23:17 +02:00
parent 50434c28cf
commit 0b56d07ed1
24 changed files with 390 additions and 283 deletions
@@ -1,25 +1,26 @@
- model_class = ProductCategory
.page-header= title :index, model_class
- if @product_categories.any?
table.table.table-striped
thead
tr
th= model_class.human_attribute_name(:name)
th= model_class.human_attribute_name(:position)
th.timestamp= model_class.human_attribute_name(:created_at)
th.actions=t 'helpers.actions'
tbody
- @product_categories.each do |product_category|
.well
- if @product_categories.any?
table.table
thead
tr
td.link= link_to product_category.name, [:suppliers, product_category]
td= product_category.position
td.timestamp=l product_category.created_at, format: :short
td.actions
= link_to t('helpers.links.edit'), [:edit, :suppliers, product_category], class: 'btn btn-mini'
'
= link_to t("helpers.links.destroy"), [:suppliers, product_category], method: :delete, data: {confirm: are_you_sure? }, class: 'btn btn-mini btn-danger'
- else
= no_content_given model_class
th= model_class.human_attribute_name(:name)
th= model_class.human_attribute_name(:position)
th.timestamp= model_class.human_attribute_name(:created_at)
th.actions=t 'helpers.actions'
tbody
- @product_categories.each do |product_category|
tr
td.link= link_to product_category.name, [:suppliers, product_category]
td= product_category.position
td.timestamp=l product_category.created_at, format: :short
td.actions
= link_to t('helpers.links.edit'), [:edit, :suppliers, product_category], class: 'btn btn-mini'
'
= link_to t("helpers.links.destroy"), [:suppliers, product_category], method: :delete, data: {confirm: are_you_sure? }, class: 'btn btn-mini btn-danger'
- else
= no_content_given model_class
.form-actions
= link_to t("helpers.links.new"), new_suppliers_product_category_path, class: 'btn btn-primary'
+24 -23
View File
@@ -1,28 +1,29 @@
- model_class = Product
.page-header= title :index, model_class
- if @products.any?
table.table.table-striped
thead
tr
th= model_class.human_attribute_name(:name)
th= model_class.human_attribute_name(:code)
th.currency= model_class.human_attribute_name(:price)
th= ProductCategory.model_name.human
th.timestamp= model_class.human_attribute_name(:created_at)
th.actions=t 'helpers.actions'
tbody
- @products.each do |product|
.well
- if @products.any?
table.table
thead
tr
td.link= link_to product.name, product
td= product.code
td.currency=currency product.price
td.link= link_to_if product.product_category.present?, product.product_category.try(:name), [:suppliers, product.product_category]
td.timestamp=l product.created_at, format: :short
td.actions
= link_to t('helpers.links.edit'), [:edit, :suppliers, product], class: 'btn btn-mini'
'
= link_to t("helpers.links.destroy"), [:suppliers, product], method: :delete, data: {confirm: are_you_sure? }, class: 'btn btn-mini btn-danger'
- else
= no_content_given model_class
th= model_class.human_attribute_name(:name)
th= model_class.human_attribute_name(:code)
th.currency= model_class.human_attribute_name(:price)
th= ProductCategory.model_name.human
th.timestamp= model_class.human_attribute_name(:created_at)
th.actions=t 'helpers.actions'
tbody
- @products.each do |product|
tr
td.link= link_to product.name, [:suppliers, product]
td= product.code
td.currency=currency product.price
td.link= link_to_if product.product_category.present?, product.product_category.try(:name), [:suppliers, product.product_category]
td.timestamp=l product.created_at, format: :short
td.actions
= link_to t('helpers.links.edit'), [:edit, :suppliers, product], class: 'btn btn-mini'
'
= link_to t("helpers.links.destroy"), [:suppliers, product], method: :delete, data: {confirm: are_you_sure? }, class: 'btn btn-mini btn-danger'
- else
= no_content_given model_class
= link_to t("helpers.links.new"), new_suppliers_product_path(product_category_id: @product_category.try(:id)), class: 'btn btn-primary'
+24 -22
View File
@@ -1,25 +1,27 @@
- model_class = Section
.page-header= title :index, model_class
- if @sections.any?
table.table.table-striped
thead
tr
th.link= model_class.human_attribute_name(:title)
th.numeric= model_class.human_attribute_name(:width)
th.numeric= model_class.human_attribute_name(:height)
th.timestamp= model_class.human_attribute_name(:created_at)
th.actions=t 'helpers.actions'
tbody
- @sections.each do |section|
.well
- if @sections.any?
table.table
thead
tr
td.link= link_to section.title, [:suppliers, section]
td.numeric= section.width
td.numeric= section.height
td.timestamp=l section.created_at, format: :short
td.actions
= link_to t('helpers.links.edit'), [:edit, :suppliers, section], class: 'btn btn-mini'
'
= link_to t("helpers.links.destroy"), [:suppliers, section], method: :delete, data: {confirm: are_you_sure? }, class: 'btn btn-mini btn-danger'
- else
= no_content_given model_class
= link_to t("helpers.links.new"), new_suppliers_section_path, class: 'btn btn-primary'
th.link= model_class.human_attribute_name(:title)
th.numeric= model_class.human_attribute_name(:width)
th.numeric= model_class.human_attribute_name(:height)
th.timestamp= model_class.human_attribute_name(:created_at)
th.actions=t 'helpers.actions'
tbody
- @sections.each do |section|
tr
td.link= link_to section.title, [:suppliers, section]
td.numeric= section.width
td.numeric= section.height
td.timestamp=l section.created_at, format: :short
td.actions
= link_to t('helpers.links.edit'), [:edit, :suppliers, section], class: 'btn btn-mini'
'
= link_to t("helpers.links.destroy"), [:suppliers, section], method: :delete, data: {confirm: are_you_sure? }, class: 'btn btn-mini btn-danger'
- else
= no_content_given model_class
.form-actions
= link_to t("helpers.links.new"), new_suppliers_section_path, class: 'btn btn-primary'
@@ -0,0 +1,36 @@
- model_class = Section
.page-header= title t('section.manage_tables.title', section: Section.model_name.human.downcase, title: @section.title)
- content_for :row do
ul.nav.nav-pills
- for section in @section.supplier.sections
li class=(section == @section ? 'active' : nil) = link_to section.title, [:suppliers, section]
.span9
.well.section-tables-container.section-tables-active
- for table in @section.tables
.section-table.hide{ id="section-table-#{table.id}" data-position-x=table.position_x data-position-y=table.position_y data-table-id=table.id}
.pull-right.action-button-container
= link_to :i, [:suppliers, table], class: 'btn btn-mini table-link'
.table-number = table.number
.span3
h3= t('table.has_no_section')
.well.section-tables-container.section-tables-inactive
- for table in @section.supplier.non_placed_tables
.section-table{ id="section-table-#{table.id}" data-position-x=table.position_x data-position-y=table.position_y data-table-id=table.id}
.pull-right.action-button-container
button.btn.btn-primary.btn-mini onClick="Qsupplier.move_table_to_active_section('#{table.id}')" +
= link_to :i, [:suppliers, table], class: 'btn btn-mini table-link'
.table-number = table.number
.clearfix
- content_for :footer do
javascript:
var current_section_id = '#{@section.id}';
var current_section_width = #{@section.width};
var current_section_height = #{@section.height};
$(function(){
var active_section_container = $('.section-tables-active')
active_section_container.css('width', active_section_container.width()); // break fluid layout
active_section_container.css('height', #{@section.height/@section.width}*active_section_container.width());
active_section_container.find('.section-table').each(function(){
Qsupplier.position_table_in_active_section(active_section_container, $(this), true);
});
});
+4 -34
View File
@@ -6,38 +6,8 @@
'
= link_to t('helpers.links.edit'), [:edit, :suppliers, @section], class: 'btn'
'
= link_to t('supplier.section.manage_tables'), [:manage_tables, :suppliers, @section], class: [:btn, 'btn-warning']
'
= link_to t('supplier.section.tables_view'), [:tables_view, :suppliers, @section], class: [:btn, 'btn-info']
'
= link_to t("helpers.links.destroy"), [:suppliers, @section], method: :delete, data: {confirm: are_you_sure? }, class: 'btn btn-danger'
- content_for :row do
ul.nav.nav-pills
- for section in @section.supplier.sections
li class=(section == @section ? 'active' : nil) = link_to section.title, [:suppliers, section]
.span9
.well.section-tables-container.section-tables-active
- for table in @section.tables
.section-table.hide{ id="section-table-#{table.id}" data-position-x=table.position_x data-position-y=table.position_y data-table-id=table.id}
.pull-right.action-button-container
= link_to :i, [:suppliers, table], class: 'btn btn-mini table-link'
.table-number = table.number
.span3
h3= t('table.has_no_section')
.well.section-tables-container.section-tables-inactive
- for table in @section.supplier.non_placed_tables
.section-table{ id="section-table-#{table.id}" data-position-x=table.position_x data-position-y=table.position_y data-table-id=table.id}
.pull-right.action-button-container
button.btn.btn-primary.btn-mini onClick="Qsupplier.move_table_to_active_section('#{table.id}')" +
= link_to :i, [:suppliers, table], class: 'btn btn-mini table-link'
.table-number = table.number
.clearfix
- content_for :footer do
javascript:
var current_section_id = '#{@section.id}';
var current_section_width = #{@section.width};
var current_section_height = #{@section.height};
$(function(){
var active_section_container = $('.section-tables-active')
active_section_container.css('width', active_section_container.width()); // break fluid layout
active_section_container.css('height', #{@section.height/@section.width}*active_section_container.width());
active_section_container.find('.section-table').each(function(){
Qsupplier.position_table_in_active_section(active_section_container, $(this), true);
});
});
@@ -0,0 +1,20 @@
- model_class = Section
- content_for :row do
.span12
.well.section-tables-container.section-tables-active
- for table in @section.tables
.section-table.hide{ id="section-table-#{table.id}" data-position-x=table.position_x data-position-y=table.position_y data-table-id=table.id}
.table-number = link_to table.number, suppliers_table_path(table)
- content_for :footer do
javascript:
var current_section_id = '#{@section.id}';
var current_section_width = #{@section.width};
var current_section_height = #{@section.height};
$(function(){
var active_section_container = $('.section-tables-active')
active_section_container.css('width', active_section_container.width()); // break fluid layout
active_section_container.css('height', #{@section.height/@section.width}*active_section_container.width());
active_section_container.find('.section-table').each(function(){
Qsupplier.position_table_in_active_section(active_section_container, $(this), false);
});
});
+22 -20
View File
@@ -1,24 +1,26 @@
- model_class = Table
div.page-header= title :index, model_class
- if @tables.any?
table.table.table-striped
thead
tr
th.link= model_class.human_attribute_name(:number)
th.link= Section.model_name.human
th.timestamp= model_class.human_attribute_name(:created_at)
th.actions=t 'helpers.actions'
tbody
- @tables.each do |table|
.well
- if @tables.any?
table.table
thead
tr
td.link= link_to table.number, [:suppliers, table]
td.link= link_to_if table.section.present?, table.section.try(:title), [:suppliers, table.section]
td.timestamp=l table.created_at, format: :short
td.actions
= link_to t('helpers.links.edit'), [:edit, :suppliers, table], class: 'btn btn-mini'
'
= link_to t("helpers.links.destroy"), [:suppliers, table], method: :delete, data: {confirm: are_you_sure? }, class: 'btn btn-mini btn-danger'
- else
= no_content_given model_class
= link_to t("helpers.links.new"), new_suppliers_table_path, class: 'btn btn-primary'
th.link= model_class.human_attribute_name(:number)
th.link= Section.model_name.human
th.timestamp= model_class.human_attribute_name(:created_at)
th.actions=t 'helpers.actions'
tbody
- @tables.each do |table|
tr
td.link= link_to table.number, [:suppliers, table]
td.link= link_to_if table.section.present?, table.section.try(:title), [:suppliers, table.section]
td.timestamp=l table.created_at, format: :short
td.actions
= link_to t('helpers.links.edit'), [:edit, :suppliers, table], class: 'btn btn-mini'
'
= link_to t("helpers.links.destroy"), [:suppliers, table], method: :delete, data: {confirm: are_you_sure? }, class: 'btn btn-mini btn-danger'
- else
= no_content_given model_class
.form-actions
= link_to t("helpers.links.new"), new_suppliers_table_path, class: 'btn btn-primary'