Skip to content

Commit

Permalink
#20 edit and new page added
Browse files Browse the repository at this point in the history
  • Loading branch information
adamdilek committed Sep 10, 2013
1 parent 6206a77 commit 1943cab
Show file tree
Hide file tree
Showing 8 changed files with 38 additions and 26 deletions.
1 change: 0 additions & 1 deletion app/assets/javascripts/application.js.coffee
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,5 @@
#= require jquery
#= require jquery_ujs
#= require turbolinks
#= require bootstrap
#= require hierapolis
#= require_tree .
15 changes: 1 addition & 14 deletions app/views/layouts/partials/_toolbar.haml
Original file line number Diff line number Diff line change
@@ -1,15 +1,2 @@
#toolbar
.btn-group
%a.btn{href: '#', data: {toggle: 'toolbar-tooltip'}, title: 'Building'}
%i.icon-building
%a.btn{href: '#', data: {toggle: 'toolbar-tooltip'}, title: 'Laptop'}
%i.icon-laptop
%a.btn{href: '#', data: {toggle: 'toolbar-tooltip'}, title: 'Calendar'}
%i.icon-calendar
%span.badge 3
%a.btn{href: '#', data: {toggle: 'toolbar-tooltip'}, title: 'Lemon'}
%i.icon-lemon
.label.label-danger
Danger
.label.label-info
Info
= yield :toolbar
5 changes: 5 additions & 0 deletions config/locales/en.yml
Original file line number Diff line number Diff line change
Expand Up @@ -24,3 +24,8 @@ en:
cancel: Cancel
tooltips:
zoom: Zoom

tt:
index: "%{resource_name} list"
edit: "Editing %{resource_name}"
new: "New %{resource_name}"
6 changes: 5 additions & 1 deletion config/locales/tr.yml
Original file line number Diff line number Diff line change
Expand Up @@ -25,4 +25,8 @@ tr:
hello: "Merhaba Dünya"
cancel: İptal
tooltips:
zoom: Detay
zoom: Detay
tt:
index: "%{resource_name} listesi"
edit: "%{resource_name} düzenle"
new: "Yeni %{resource_name}"
23 changes: 14 additions & 9 deletions lib/templates/haml/scaffold/_form.html.haml
Original file line number Diff line number Diff line change
@@ -1,11 +1,16 @@
= simple_form_for(@<%= singular_table_name %>) do |f|
= f.error_notification
.panel
.panel-heading
%i.icon-edit.icon-large
= yield :form_title
.panel-body
= simple_form_for(@<%= singular_table_name %>) do |f|
= f.error_notification

.form-inputs
<%- attributes.each do |attribute| -%>
= f.<%= attribute.reference? ? :association : :input %> :<%= attribute.name %>
<%- end -%>
.form-inputs
<%- attributes.each do |attribute| -%>
= f.<%= attribute.reference? ? :association : :input %> :<%= attribute.name %>
<%- end -%>

.form-actions
= f.button :submit, class: 'btn btn-default'
= link_to t('cancel'), <%= index_helper %>_path, class: 'btn'
.form-actions
= f.button :submit, class: 'btn btn-default'
= link_to t('cancel'), <%= index_helper %>_path, class: 'btn'
3 changes: 3 additions & 0 deletions lib/templates/haml/scaffold/edit.html.haml
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
- content_for :form_title do
= t('tt.edit', resource_name: <%= singular_table_name.capitalize %>.model_name.human)
= render 'form'
8 changes: 7 additions & 1 deletion lib/templates/haml/scaffold/index.html.haml
Original file line number Diff line number Diff line change
@@ -1,9 +1,15 @@
<% @search = "" -%>
<% attributes.each { |attribute| @search += "_#{attribute.name}_or" } -%>

- content_for :toolbar do
= link_to new_<%= singular_table_name %>_path, class: 'btn btn-default' do
%i.icon-plus
= t('tt.new', resource_name: <%= singular_table_name.capitalize %>.model_name.human)

.panel.tables
.panel-heading
%i.icon-table.icon-large
Default Table
= t('tt.index', resource_name: <%= singular_table_name.capitalize %>.model_name.human)
.panel-tools
.btn-group
%a.btn{href: '#'}
Expand Down
3 changes: 3 additions & 0 deletions lib/templates/haml/scaffold/new.html.haml
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
- content_for :form_title do
= t('tt.new', resource_name: <%= singular_table_name.capitalize %>.model_name.human)
= render 'form'

0 comments on commit 1943cab

Please sign in to comment.