Better cmtool integration

This commit is contained in:
2015-02-25 12:54:07 +01:00
parent 6a47ecb0eb
commit fd9afb9d53
15 changed files with 110 additions and 72 deletions
+3 -3
View File
@@ -1,6 +1,6 @@
GIT GIT
remote: git://github.com/bterkuile/cmtool.git remote: git://github.com/bterkuile/cmtool.git
revision: e2f8459960eb4eff12365c6ebd60278d79eaab8f revision: b0491aa997cca6e791b7352f40e2adf90191a1cd
specs: specs:
cmtool (1.0.0) cmtool (1.0.0)
bourbon bourbon
@@ -112,7 +112,7 @@ GEM
bcrypt (3.1.10) bcrypt (3.1.10)
binding_of_caller (0.7.2) binding_of_caller (0.7.2)
debug_inspector (>= 0.0.1) debug_inspector (>= 0.0.1)
bourbon (4.2.0) bourbon (4.2.1)
sass (~> 3.4) sass (~> 3.4)
thor thor
builder (3.2.2) builder (3.2.2)
@@ -376,7 +376,7 @@ GEM
ruby-progressbar (1.7.1) ruby-progressbar (1.7.1)
rubyzip (1.1.7) rubyzip (1.1.7)
safe_yaml (1.0.4) safe_yaml (1.0.4)
sass (3.4.11) sass (3.4.12)
sass-rails (5.0.1) sass-rails (5.0.1)
railties (>= 4.0.0, < 5.0) railties (>= 4.0.0, < 5.0)
sass (~> 3.1) sass (~> 3.1)
@@ -1,4 +1,5 @@
//= require_self //= require_self
//= require_directory . //= require_directory .
@import 'foundation_and_overrides' @import 'foundation_and_overrides'
@import ./components/*
@@ -0,0 +1,3 @@
table
&.table
width: 100%
@@ -18,3 +18,15 @@
.content-container .content-container
position: relative position: relative
max-width: $content-max-width max-width: $content-max-width
=theme-button
border: none
background: image-url('theme1/button-wood-right.png') 100% 0 no-repeat, image-url('theme1/button-wood-left.png') 0 0 no-repeat, image-url('theme1/button-wood-middle.png') 9px 0 repeat-x
color: white
height: 31px
display: inline-block
padding-left: 8px
padding-right: 8px
line-height: 30px
&:hover
color: white
text-decoration: underline
@@ -0,0 +1,2 @@
.theme-button
+theme-button
+6 -1
View File
@@ -25,6 +25,10 @@ private
redirect_to '/', alert: t('general.unauthorized') unless current_user.present? && current_user.admin? redirect_to '/', alert: t('general.unauthorized') unless current_user.present? && current_user.admin?
end end
def cmtool_locale
:en
end
def broadcast_user(uid, event, data = {}) def broadcast_user(uid, event, data = {})
Qwaiter.broadcast_user uid, event, data Qwaiter.broadcast_user uid, event, data
end end
@@ -34,7 +38,8 @@ private
end end
def set_locale def set_locale
I18n.locale = (params[:locale].presence || I18n.default_locale).to_sym #session[:locale] = (params[:locale].presence || session[:locale] || Rails.configuration.i18n.default_locale).to_sym
I18n.locale = params[:locale].presence.try(:to_sym) || Rails.configuration.i18n.default_locale
end end
def _render_with_renderer_json(resource, options) def _render_with_renderer_json(resource, options)
+2 -4
View File
@@ -1,18 +1,16 @@
- model_class = Supplier - model_class = Supplier
.page-header= title :index, model_class .page-header= title :index, model_class
- if @suppliers.any? - if @suppliers.any?
table.table.table-striped.table-hover table.table
thead thead
tr tr
th= model_class.human_attribute_name(:email)
th= model_class.human_attribute_name(:name) th= model_class.human_attribute_name(:name)
th= model_class.human_attribute_name(:created_at) th= model_class.human_attribute_name(:created_at)
th=t 'helpers.actions.title' th=t 'helpers.actions.title'
tbody tbody
- @suppliers.each do |supplier| - @suppliers.each do |supplier|
tr tr
td= link_to supplier.email, [:admin, supplier] td= link_to supplier.name, [:admin, supplier]
td= supplier.name
td=l supplier.created_at, format: :short td=l supplier.created_at, format: :short
td td
= link_to t('helpers.links.edit'), [:edit, :admin, supplier], class: 'btn btn-mini' = link_to t('helpers.links.edit'), [:edit, :admin, supplier], class: 'btn btn-mini'
+34 -37
View File
@@ -12,42 +12,39 @@ html lang="en"
/[if lt IE 9] /[if lt IE 9]
= javascript_include_tag "http://html5shim.googlecode.com/svn/trunk/html5.js" = javascript_include_tag "http://html5shim.googlecode.com/svn/trunk/html5.js"
= stylesheet_link_tag "admin/application", :media => "all" = stylesheet_link_tag "admin/application", :media => "all"
link href="images/apple-touch-icon-144x144.png" rel="apple-touch-icon-precomposed" sizes="144x144"
link href="images/apple-touch-icon-114x114.png" rel="apple-touch-icon-precomposed" sizes="114x114"
link href="images/apple-touch-icon-72x72.png" rel="apple-touch-icon-precomposed" sizes="72x72"
link href="images/apple-touch-icon.png" rel="apple-touch-icon-precomposed"
link href="images/favicon.ico" rel="shortcut icon"
body body
nav.top-bar
ul.title-area
li.name: h4= link_to application_title, admin_root_path
section.top-bar-section
ul.left
li= link_to User.model_name.human_plural, admin_users_path
li= link_to "User Feedback", admin_user_feedbacks_path
li.divider
ul.left
li.has-dropdown.not-click
a href="#" = Supplier.model_name.human_plural
ul.dropdown
li= link_to Supplier.model_name.human_plural, admin_suppliers_path
li= link_to Section.model_name.human_plural, admin_sections_path
li= link_to Table.model_name.human_plural, admin_tables_path
li= link_to Product.model_name.human_plural, admin_products_path
li= link_to List.model_name.human_plural, admin_lists_path
li= link_to Order.model_name.human_plural, admin_orders_path
li= link_to ProductCategory.model_name.human_plural, admin_product_categories_path
li.divider
- if administrator_signed_in?
ul.right
li.divider
li.has-dropdown.not-click
a href="#" = current_administrator.email
ul.dropdown
li.log-out= link_to t('helpers.links.logout'), destroy_administrator_session_path
.container
- if defined?(Cmtool)
= render 'cmtool/application/menu'
- else
nav.top-bar
ul.title-area
li.name: h4= link_to application_title, admin_root_path
section.top-bar-section
ul.left
li= link_to User.model_name.human_plural, admin_users_path
li= link_to "User Feedback", admin_user_feedbacks_path
li.divider
ul.left
li.has-dropdown.not-click
a href="#" = Supplier.model_name.human_plural
ul.dropdown
li= link_to Supplier.model_name.human_plural, admin_suppliers_path
li= link_to Section.model_name.human_plural, admin_sections_path
li= link_to Table.model_name.human_plural, admin_tables_path
li= link_to Product.model_name.human_plural, admin_products_path
li= link_to List.model_name.human_plural, admin_lists_path
li= link_to Order.model_name.human_plural, admin_orders_path
li= link_to ProductCategory.model_name.human_plural, admin_product_categories_path
li.divider
- if administrator_signed_in?
ul.right
li.divider
li.has-dropdown.not-click
a href="#" = current_administrator.email
ul.dropdown
li.log-out= link_to t('helpers.links.logout'), destroy_administrator_session_path
.container
.content .content
- if flash[:alert].present? - if flash[:alert].present?
.alert-box.alert .alert-box.alert
@@ -58,10 +55,10 @@ html lang="en"
a.close data-dismiss="alert" &#215; a.close data-dismiss="alert" &#215;
div= flash[:notice] div= flash[:notice]
.row .row
.large-9.columns .small-12.large-9.columns
= yield = yield
.large-3.columns .show-for-large-up.large-3.columns
.well.sidebar-nav .panel
h3= application_title h3= application_title
hr hr
ul.side-nav ul.side-nav
+1 -9
View File
@@ -27,15 +27,7 @@ html lang="en"
.container .container
.content-top .content-top
.main-inner .main-inner
.general-alerts = render 'theme1/alerts'
- if flash[:alert].present?
.flash-box.alert
div= flash[:alert]
a.close data-dismiss="alert" &#215;
- if flash[:notice].present?
.flash-box.notice
div= flash[:notice]
a.close data-dismiss="alert" &#215;
= yield :page_title = yield :page_title
= yield = yield
= render 'theme1/footer' = render 'theme1/footer'
+2 -9
View File
@@ -1,5 +1,5 @@
doctype html doctype html
html lang="en" html lang=I18n.locale
head head
title= site_page_title title= site_page_title
= render 'meta' = render 'meta'
@@ -22,14 +22,7 @@ html lang="en"
#main-wrap #main-wrap
.container .container
.main-inner .main-inner
- if flash[:alert].present? = render 'theme1/alerts'
.flash-box.alert
div= flash[:alert]
a.close data-dismiss="alert" &#215;
- if flash[:notice].present?
.flash-box.notice
div= flash[:notice]
a.close data-dismiss="alert" &#215;
- if @page && @page.title.present? - if @page && @page.title.present?
h1.page-title= @page.title h1.page-title= @page.title
= yield = yield
+11
View File
@@ -1,3 +1,14 @@
.row
.small-12.columns
ul
li Its free!
li
span To try do the following
ul
li Create and setup a restaurant account
li Open the qr codes page displaying the qr-codes of your created tables
li Download the app on your phone to test as a user
li Scan a qr-code from you restaurant screen with your phone, and you can test ordering products!!!
.row .row
.large-7.large-offset-1.columns .large-7.large-offset-1.columns
= form_for @new_supplier do |f| = form_for @new_supplier do |f|
+8
View File
@@ -0,0 +1,8 @@
- if flash[:alert].present?
.alert-box.warning
= flash[:alert]
a.close data-dismiss="alert" &#215;
- if flash[:notice].present?
.alert-box.info
= flash[:notice]
a.close data-dismiss="alert" &#215;
+1
View File
@@ -1,3 +1,4 @@
a.theme-button Test
.social .social
a.wsite-social-facebook href="https://www.facebook.com/mozo.bar" target=:_blank a.wsite-social-facebook href="https://www.facebook.com/mozo.bar" target=:_blank
span.wsite-social-inner span.wsite-social-inner
+17 -2
View File
@@ -74,8 +74,8 @@ module Qwaiter
# The default locale is :en and all translations from config/locales/*.rb,yml are auto loaded. # The default locale is :en and all translations from config/locales/*.rb,yml are auto loaded.
# config.i18n.load_path += Dir[Rails.root.join('my', 'locales', '*.{rb,yml}').to_s] # config.i18n.load_path += Dir[Rails.root.join('my', 'locales', '*.{rb,yml}').to_s]
config.i18n.default_locale = :nl config.i18n.default_locale = :en
config.i18n.available_locales = [:nl, :en] config.i18n.available_locales = [:en, :nl]
# Configure the default encoding used in templates for Ruby 1.9. # Configure the default encoding used in templates for Ruby 1.9.
config.encoding = "utf-8" config.encoding = "utf-8"
@@ -86,6 +86,21 @@ module Qwaiter
# Enable escaping HTML in JSON. # Enable escaping HTML in JSON.
config.active_support.escape_html_entities_in_json = true config.active_support.escape_html_entities_in_json = true
initializer 'mozo.cmtool', after: 'cmtool.build_menu' do
Cmtool::Menu.register do
before :users do
group label: :mozo do # Allow other tools to inject into the mozo menu
title 'Mozo'
resource_link UserFeedback, scope: 'Admin'
resource_link Supplier, scope: 'Admin'
resource_link Section, scope: 'Admin'
resource_link Table, scope: 'Admin'
engine_link Rails.application, title: 'Go to the website', path: '/'
end
end
end
end
config.handlebars.templates_root = %w[supplier/app/templates waiter/app/templates user/app/templates] if defined?(Ember::Rails) && defined?(Handlebars) config.handlebars.templates_root = %w[supplier/app/templates waiter/app/templates user/app/templates] if defined?(Ember::Rails) && defined?(Handlebars)
+7 -7
View File
@@ -1,4 +1,4 @@
ALLOWED_LOCALES = /nl|be|de|fr|en/ ALLOWED_LOCALES = /nl|de|fr|en|es/
Qwaiter::Application.routes.draw do Qwaiter::Application.routes.draw do
devise_for :users, controllers: { omniauth_callbacks: "users/omniauth_callbacks" } devise_for :users, controllers: { omniauth_callbacks: "users/omniauth_callbacks" }
#devise_for :suppliers, controllers: { confirmations: 'confirmations', registrations: 'registrations' } #devise_for :suppliers, controllers: { confirmations: 'confirmations', registrations: 'registrations' }
@@ -172,12 +172,12 @@ Qwaiter::Application.routes.draw do
mount Cmtool::Engine => '/cmtool' mount Cmtool::Engine => '/cmtool'
root :to => 'pages#home', defaults: {locale: 'nl'} #get '/:locale' => 'pages#home', constraints: {locale: ALLOWED_LOCALES}
get '/:locale' => 'pages#home', constraints: {locale: ALLOWED_LOCALES} #devise_scope :supplier do
devise_scope :supplier do #get '/:locale/suppliers/sign_up' => 'registrations#new', constraints: {locale: ALLOWED_LOCALES}
get '/:locale/suppliers/sign_up' => 'registrations#new', constraints: {locale: ALLOWED_LOCALES} #end
end scope '(/:locale)', constraints: {locale: ALLOWED_LOCALES}, defaults: { locale: 'en' } do
scope '(/:locale)', constraints: {locale: ALLOWED_LOCALES}, defaults: { locale: 'nl' } do root to: 'pages#home'
get "/:name" => "pages#show", constraints: {name: /.*/}, as: :go_to get "/:name" => "pages#show", constraints: {name: /.*/}, as: :go_to
end end
end end