Better supplier section view

This commit is contained in:
2014-06-27 16:26:20 +02:00
parent b5a68e9627
commit dbb369acb9
10 changed files with 52 additions and 23 deletions
@@ -4,7 +4,7 @@
view Qsupplier.App.SectionTabHeaderView context=section
.section-manage-tables.pull-right
if editmode
.btn-group
/.btn-group
/a.btn.dropdown-toggle data-toggle="dropdown" href="#section-background"
span Background
span.caret
@@ -12,19 +12,19 @@
each texture in textures
li
a{ action setTexture texture } {{texture}}
.btn-group
button.btn.dropdown-toggle data-toggle="dropdown"
span Action
span.caret
ul#section-actions.dropdown-menu
li
a{action addTables} {{t 'section.add_tables.button_label'}}
li
a{action arrangeTables} {{t 'section.arrange_tables.modal.title'}}
li
a href="{{route 'qr_codes_suppliers_tables_path' section_id=id}}" {{t 'tables.qr_codes.link'}}
li
a href="{{route 'suppliers_section_path' id}}" data-method="delete" data-confirm="{{t 'helpers.links.are_you_sure' bare=true}}" {{t 'helpers.links.destroy'}}
a.tiny.button.dropdown href="#" data-dropdown="section-action-list" Action
/button.btn.dropdown-toggle data-toggle="dropdown"
span Action
span.caret
ul#section-action-list.f-dropdown data-dropdown-content=true
li
a{action addTables} {{t 'section.add_tables.button_label'}}
li
a{action arrangeTables} {{t 'section.arrange_tables.modal.title'}}
li
a href="{{route 'qr_codes_suppliers_tables_path' section_id=id}}" {{t 'tables.qr_codes.link'}}
li
a href="{{route 'suppliers_section_path' id}}" data-method="delete" data-confirm="{{t 'helpers.links.are_you_sure' bare=true}}" {{t 'helpers.links.destroy'}}
view Ember.TextField valueBinding="title" class="section-edit-title-field"
view Ember.TextField valueBinding="width" class="dimension section-edit-width-field"
span x
@@ -32,5 +32,4 @@
a.section-normal-mode-button{ action finishEditable }: span
else
a.section-edit-mode-button{ action makeEditable }: span
each table in tables
view 'Qsupplier.App.SectionTableView' contentBinding="table"
Qsupplier.App.SectionTablesView contentBinding="tables"
@@ -0,0 +1,2 @@
each table in tables
Qsupplier.App.SectionTableView contentBinding="table"
@@ -15,7 +15,7 @@ div class="table-actions table-actions-#{unbound table.id}"
a href="suppliers_table_path(@table)" {{t 'section.tables_view.table_actions.got_to_table'}}
each user in table.active_list.users
img src=user.facebook_image
if editmode
if editmodedisabled
.table-settings
select
option Round
@@ -52,7 +52,7 @@ Qsupplier.App.SectionTableView = Ember.View.extend DragNDrop.Draggable,
#@$('.table-actions .title').remove()
content.hide()
@$el.on 'click', =>
content.toggle()
content.toggle() if @$el.hasClass('occupied')
#@$el.qtip
#content:
#text: content
@@ -1,5 +1,6 @@
Qsupplier.App.SectionView = Ember.View.extend DragNDrop.Droppable,
Qsupplier.App.SectionTablesView = Ember.View.extend DragNDrop.Droppable,
classNames: ['well', 'section-tables-container', 'section-tables-active']
templateName: 'section_tables'
didInsertElement: ->
@$el = $(@get('element'))
height = @$el.width() * @get('controller.model.height') / @get('controller.model.width')
@@ -12,6 +13,7 @@ Qsupplier.App.SectionView = Ember.View.extend DragNDrop.Droppable,
height = @$el.width() * @get('controller.model.height') / @get('controller.model.width')
@$el.css('height', height)
).observes('controller.model.height', 'controller.model.width')
tables: (->@get('content')).property('content')
didInsertElement: ->
# the first observable event is triggered without the container having its dimensions
@get('controller.model').notifyPropertyChange('width').notifyPropertyChange('height')
@@ -1,6 +1,8 @@
//= require jquery
//= require jquery_ujs
//= require jquery.ui.sortable
//= require vendor/modernizr
//= require foundation
//= require js-routes
//= require translations
//= require qwaiter
@@ -18,6 +20,8 @@ var Qstorage = localStorage;
$.extend($translations.en, <%= I18n.t('supplier', locale: :en).to_json %>);
$.extend($translations.nl, <%= I18n.t('supplier', locale: :nl).to_json %>);
$(document).foundation();
String.prototype.capitalize = function() {
return this.charAt(0).toUpperCase() + this.slice(1);
}