Skip to content

Commit

Permalink
fixed some spec and now fully support new spree 1.3 admin interface
Browse files Browse the repository at this point in the history
  • Loading branch information
sbounmy committed Feb 25, 2013
1 parent d2932dd commit 77e57da
Show file tree
Hide file tree
Showing 17 changed files with 239 additions and 144 deletions.
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -7,3 +7,4 @@ pkg/*
test/dummy_hooks/after_migrate.rb
test/dummy
.rvmrc
.sass-cache
5 changes: 3 additions & 2 deletions Gemfile
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
source "http://rubygems.org"
source "https://rubygems.org"

gem 'spree_essentials', :git => 'git://github.com/sbounmy/spree_essentials'
gem 'spree_essentials', :git => 'git://github.com/sbounmy/spree_essentials.git'
gem 'spree_multi_lingual', :git => "git://github.com/jipiboily/spree_multi_lingual.git", :branch => '1-3-stable'

gemspec
82 changes: 53 additions & 29 deletions app/views/spree/admin/contents/index.html.erb
Original file line number Diff line number Diff line change
@@ -1,53 +1,77 @@
<div class='toolbar'>
<ul class='actions'>
<% content_for :page_title do %>
<%= t('.listing_contents') %>
<% end %>
<% content_for :page_actions do %>
<div class="toolbar" data-hook="toolbar">
<ul class="actions header-action-links inline-menu">
<li>
<p><%= button_link_to t('.new_content'), new_object_url, :icon => 'add' %></p>
<%= button_link_to t('.new_content'), new_object_url, :icon => 'icon-plus' %>
</li>
</ul>
<br class='clear' />
</ul>
</div>
<% end %>
<% content_for :table_filter_title do %>
<%= t(:search) %>
<% end %>

<div id="table-filter" data-hook class="twelve columns">
<fieldset>
<legend align="center"><%= yield :table_filter_title %></legend>
<div data-hool='admin_contents_sidebar'>

<%= search_form_for [:admin, @page, @search] do |f| %>
<div data-hook="admin_contents_index_search">
<div class="alpha six columns">
<div class="field">
<%= f.label :title_cont, t('content.title') %>
<%= f.text_field :title_cont, :size => 25 %>
</div>
</div>
<div class="five columns">
<div class="field">
<%= f.label :context_cont, t('content.context') %>
<%= f.text_field :context_cont, :size => 25 %>
</div>
</div>
</div>

<div class="clear"></div>

<div class="form-buttons actions filter-actions" data-hook="admin_contents_index_search_buttons">
<%= button t(:search), 'icon-search' %>
</div>

<% end %>

</div>
</fieldset>
</div>

<%= render :partial => 'spree/admin/shared/page_tabs', :locals => {:current => 'Contents'} %>

<h2><%= t('.listing_contents') %></h2>

<table class="index sortable" data-sortable-link="<%= update_positions_admin_page_contents_url(@page) -%>">
<thead>
<tr>
<th><%= sort_link @search, :title, t("content.title") %></th>
<th><%= sort_link @search, :context, t("content.context") %></th>
<th><%= t("action") %></th>
<th data-hook="admin_contents_index_header_actions" class="actions"></th>
</tr>
</thead>
<tbody>
<%- @collection.each do |content|%>
<tr id="<%= spree_dom_id content %>">
<td><span class="handle">&nbsp;</span>&nbsp; <%= link_to content.title, object_url(content) %></td>
<td><%= content.context %>
<td>
<%= link_to_edit content %> &nbsp;
<%= link_to_delete content %>
<td class='actions'>
<%= link_to_edit content, :no_text => true, :class => 'edit' %>
&nbsp;
<%= link_to_delete content, :no_text => true %>
</td>
</tr>
<% end %>
</tbody>
</table>

<%= paginate @collection %>
<% content_for :sidebar do %>
<div class="box">
<h3><%= t(:search) %></h3>
<%= search_form_for [:admin, @page, @search] do |f| %>
<p>
<%= f.label :title_cont, t('content.title') %><br />
<%= f.text_field :title_cont, :size => 25 %>
</p>
<p>
<%= f.label :context_cont, t('content.context') %><br />
<%= f.text_field :context_cont, :size => 25 %>
</p>
<p><%= button t("search") %></p>
<% end %>
</div>
<% end %>
<%= paginate @collection %>
14 changes: 8 additions & 6 deletions app/views/spree/admin/page_images/_form.html.erb
Original file line number Diff line number Diff line change
@@ -1,8 +1,10 @@
<p>
<%= form.label :attachment %>:<br/>
<%= form.field_container :attachment do %>
<%= form.label :attachment %>
<%= form.file_field :attachment %>
</p>
<p>
<%= form.label :alt %>:<br/>
<% end %>
<%= form.field_container :alt do %>
<%= form.label :alt %>
<%= form.text_field :alt, :class => 'text' %>
</p>
<% end %>

16 changes: 12 additions & 4 deletions app/views/spree/admin/page_images/index.html.erb
Original file line number Diff line number Diff line change
@@ -1,5 +1,17 @@
<% content_for :page_actions do %>
<div class="toolbar" data-hook="toolbar">
<ul class="actions header-action-links inline-menu">
<li>
<%= button_link_to t("new_image"), new_object_url, :icon => 'icon-plus', :id => "new_image_link" %>
</li>
</ul>
</div>
<% end %>
<%= render :partial => 'spree/admin/shared/page_tabs', :locals => {:current => "Images"} %>

<div id="images"></div>

<table class="index sortable" data-sortable-link="<%= update_positions_admin_page_images_url(@page) -%>">
<thead>
<tr>
Expand All @@ -24,10 +36,6 @@
</table>

<div id="images"></div>
<br/>
<p>
<%= link_to icon('add') + ' ' + t("new_image"), new_admin_page_image_url(@page), :id => "new_image_link" %>
</p>

<% content_for :head do %>
<script type="text/javascript">
Expand Down
21 changes: 7 additions & 14 deletions app/views/spree/admin/page_images/new.html.erb
Original file line number Diff line number Diff line change
@@ -1,22 +1,15 @@
<%= render :partial => 'spree/admin/shared/page_tabs', :locals => {:current => "Images"} unless request.xhr? %>
<h3><%= t("new_image") %></h3>

<%= render 'spree/shared/error_messages', :target => @page_image %>
<%= form_for(@page_image, :url => admin_page_images_path(@page), :html => { :multipart => true }) do |form| %>
<table class="basic-table">
<fieldset data-hook="new_product">

<legend align="center"><%= t(:new_image) %></legend>

<%= render "form", :form => form %>
</table>
<p class="form-buttons">
<%= button t("create") %>
or <%= link_to t("cancel"), "#", :id => "cancel_link" %>
</p>
<%= render :partial => 'spree/admin/shared/new_resource_links' %>
</fieldset>
<% end %>

<script type="text/javascript">
jQuery('#cancel_link').click(function (event) {
jQuery('#new_image_link').show();
jQuery('#images').html('');
});
</script>
68 changes: 43 additions & 25 deletions app/views/spree/admin/pages/index.html.erb
Original file line number Diff line number Diff line change
@@ -1,13 +1,48 @@
<div class='toolbar'>
<ul class='actions'>
<% content_for :page_title do %>
<%= t('.listing_pages') %>
<% end %>
<% content_for :page_actions do %>
<div class="toolbar" data-hook="toolbar">
<ul class="actions header-action-links inline-menu">
<li>
<p><%= button_link_to t('.new_page'), new_object_url, :icon => 'add' %></p>
<%= button_link_to t('.new_page'), new_object_url, :icon => 'icon-plus' %>
</li>
</ul>
<br class='clear' />
</div>
</ul>
</div>
<% end %>
<% content_for :table_filter_title do %>
<%= t(:search) %>
<% end %>
<% content_for :table_filter do %>
<div data-hool='admin_pages_sidebar'>

<%= search_form_for [:admin, @search] do |f| %>
<div data-hook="admin_pages_index_search">
<div class="alpha nine columns">
<div class="field">
<%= f.label :title_cont, t('page.title') %>
<%= f.text_field :title_cont, :size => 25 %>
</div>
</div>
<div class="four columns">
<div class="field">
<%= f.label :path_cont, t('page.path') %>
<%= f.text_field :path_cont, :size => 25 %>
</div>
</div>
</div>

<h1><%= t('.listing_pages') %></h1>
<div class="clear"></div>

<div class="form-buttons actions filter-actions" data-hook="admin_pages_index_search_buttons">
<%= button t(:search), 'icon-search' %>
</div>
<% end %>
</div>
<% end %>

<table class="index sortable" data-sortable-link="<%= update_positions_admin_pages_url -%>">
<thead>
Expand Down Expand Up @@ -37,21 +72,4 @@
</tbody>
</table>

<%= paginate @collection %>
<% content_for :sidebar do %>
<div class="box">
<h3><%= t(:search) %></h3>
<%= search_form_for [:admin, @search] do |f| %>
<p>
<%= f.label :title_cont, t('page.title') %><br />
<%= f.text_field :title_cont, :size => 25 %>
</p>
<p>
<%= f.label :path_cont, t('page.path') %><br />
<%= f.text_field :path_cont, :size => 25 %>
</p>
<p><%= button t("search") %></p>
<% end %>
</div>
<% end %>
<%= paginate @collection %>
4 changes: 1 addition & 3 deletions app/views/spree/admin/pages/new.html.erb
Original file line number Diff line number Diff line change
Expand Up @@ -9,8 +9,6 @@
<%= form_for([:admin, @page], :html => { :multipart => true }) do |f| %>
<%= render "form", :form => f %>
<p class="form-buttons">
<%= button t('create') %> <%= t('or') %> <%= link_to t('cancel'), collection_url %>
</p>
<%= render :partial => 'spree/admin/shared/new_resource_links' %>
<% end %>

37 changes: 21 additions & 16 deletions app/views/spree/admin/shared/_page_tabs.html.erb
Original file line number Diff line number Diff line change
@@ -1,21 +1,26 @@
<h1><%= (t('.editing_page') + " &ldquo;#{@page.title}&rdquo;").html_safe %></h1>
<% content_for :page_title do %>
<%= (t('.editing_page') + " &ldquo;#{@page.title}&rdquo;").html_safe %>
<% end %>
<% content_for :sidebar do %>
<% content_for :sidebar_title do %>
<span class="title"><%= @page.title %></span>
<% end %>
<h3 class="name"><%= @page.title %></h3>
<br clear="clear" />
<ul class="sidebar post-menu">
<li<%== ' class="active"' if current == t('.page_details') %>>
<%= link_to t('.page_details'), edit_admin_page_url(@page) %>
</li>
<li<%== ' class="active"' if current == "Contents" %>>
<%= link_to t('.contents'), admin_page_contents_url(@page) %>
</li>
<li<%== ' class="active"' if current == "Images" %>>
<%= link_to t('.images'), admin_page_images_url(@page) %>
</li>
</ul>
<br clear="clear" />
<% content_for :sidebar do %>

<nav class="menu">
<ul data-hook="admin_page_tabs">
<li<%== ' class="active"' if current == t('.page_details') %>>
<%= link_to_with_icon 'icon-edit', t('.page_details'), edit_admin_page_url(@page) %>
</li>
<li<%== ' class="active"' if current == 'Contents' %>>
<%= link_to_with_icon 'icon-th-large', t('.contents'), admin_page_contents_url(@page) %>
</li>
<li<%== ' class="active"' if current == 'Images' %>>
<%= link_to_with_icon 'icon-picture', t('.images'), admin_page_images_url(@page) %>
</li>
</ul>
</nav>

<% end %>
4 changes: 3 additions & 1 deletion spree_essential_cms.gemspec
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,9 @@ Gem::Specification.new do |s|
s.add_development_dependency('capybara', '~> 1.1.2')
s.add_development_dependency('sqlite3', '~> 1.3.5')
s.add_development_dependency('launchy')

s.add_development_dependency('sass-rails')
s.add_development_dependency('coffee-rails')
s.add_development_dependency('debugger')
# rake 0.9+ breaks when running rake...
s.add_development_dependency('rake', '0.8.7')
# s.add_development_dependency('simplecov', '~> 0.6.1')
Expand Down
1 change: 0 additions & 1 deletion test/dummy_hooks/after_app_generator.rb
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
# Add our main menu override
copy_file "overrides/main_menu.rb", "app/overrides/main_menu.rb"

>>>>>>> 0c88c51... allow i18n for contents
# remove all stylesheets except core
%w(admin store).each do |ns|
template "assets/javascripts/#{ns}/all.js", "app/assets/javascripts/#{ns}/all.js", :force => true
Expand Down
2 changes: 2 additions & 0 deletions test/dummy_hooks/templates/assets/javascripts/admin/all.js
Original file line number Diff line number Diff line change
@@ -1 +1,3 @@
//= require application
//= require admin/spree_core

Loading

0 comments on commit 77e57da

Please sign in to comment.