diff --git a/.gitignore b/.gitignore index 173ac63..096dbac 100644 --- a/.gitignore +++ b/.gitignore @@ -8,3 +8,4 @@ Gemfile.lock pkg/* test/dummy_hooks/after_migrate.rb test/dummy +.sass-cache diff --git a/.travis.yml b/.travis.yml index 9345646..6492e9e 100644 --- a/.travis.yml +++ b/.travis.yml @@ -1,8 +1,5 @@ rvm: - - 1.8.7 - - 1.9.2 - 1.9.3 - - ree before_script: - "sh -e /etc/init.d/xvfb start" diff --git a/Gemfile b/Gemfile index 18a1a38..1c1d1dd 100644 --- a/Gemfile +++ b/Gemfile @@ -3,4 +3,4 @@ gemspec group :development, :test do gem "spree_essential_example", :path => "test/spree_essential_example" -end +end \ No newline at end of file diff --git a/README.md b/README.md index af6d955..50b7184 100644 --- a/README.md +++ b/README.md @@ -1,4 +1,4 @@ -# Spree Essentials [](http://travis-ci.org/citrus/spree_essentials) +# Spree Essentials [](http://travis-ci.org/sbounmy/spree_essentials) Spree Essentials is the base for many content related extensions for Spree. It doesn't do much on it's own ;) @@ -12,11 +12,12 @@ Spree Essentials provides other extensions with: Current essential-aware extensions include: -* [spree_essential_cms](https://github.com/citrus/spree_essential_cms): A full featured CMS with pages, contents, images and more +* [spree_essential_cms](https://github.com/sbounmy/spree_essential_cms): A full featured CMS with pages, contents, images and more (Maintained by me) * [spree_essential_blog](https://github.com/citrus/spree_essential_blog): A blog complete with archives, categories, tags and related products * [spree_essential_press](https://github.com/citrus/spree_essential_press): A simple press page for displaying media related content. + ------------------------------------------------------------------------------ Installation ------------------------------------------------------------------------------ @@ -24,30 +25,17 @@ Installation If you don't already have an existing Spree site, [click here](https://gist.github.com/946719) then come back later... You can also read the Spree docs [here](http://spreecommerce.com/documentation/getting_started.html)... Spree Essentials can be installed by itself by adding the following to your Gemfile: - -```ruby -# Spree 1.1.x -gem 'spree_essentials', '~> 0.5.0' -# Spree 1.0.x -gem 'spree_essentials', '~> 0.4.0' - -# Spree 0.70.x -gem 'spree_essentials', '~> 0.3.3' +```ruby +# Spree 2.0.x +gem 'spree_essentials', :git => "git://github.com/sbounmy/spree_essentials.git", :branch => 'master' -# Spree 0.60.x -gem 'spree_essentials', '~> 0.2.3' +# Spree 1.3.x +gem 'spree_essentials', :git => "git://github.com/sbounmy/spree_essentials.git", :branch => '1-3-stable' ``` -This isn't necessary if you're using spree_essentials based extensions. If that's the case, just include the extensions normally: - -```ruby -gem 'spree_essential_cms' -gem 'spree_essential_blog' -``` - Then run: - + ```bash bundle install ``` @@ -55,19 +43,19 @@ bundle install Once that's complete, run the migration generator and migrate your database: To see your available generators run - + ```bash rails g ``` - -Now run the generators for extensions you wish to install -```bash +Now run the generators for extensions you wish to install + +```bash rails g spree_essentials:install rails g spree_essentials:cms rails g spree_essentials:blog ``` - + Then migrate your database: ```bash @@ -150,7 +138,7 @@ If you're using the [CMS](https://github.com/citrus/spree_essential_cms) or [blo ```ruby # app/models/spree/asset_decorator.rb -[ Spree::Content, Spree::PageImage, Spree::PostImage, Spree::Upload ].each do |cls| +[ Spree::Content, Spree::PageImage, Spree::PostImage, Spree::Upload ].each do |cls| cls.attachment_definitions[:attachment].merge!( :storage => 's3', :s3_credentials => Rails.root.join('config', 's3.yml'), @@ -169,7 +157,7 @@ Notes Spree Essentials is under constant development... Development is being done on OSX with Ruby 1.9.3 and usually the latest version of Spree. (currently 1.1.0) -Please let me know if you find any bugs or have feature requests you'd like to see. +Please let me know if you find any bugs or have feature requests you'd like to see. ------------------------------------------------------------------------------ @@ -179,22 +167,22 @@ Testing The test suite can be run like so: ```bash -git clone git://github.com/citrus/spree_essentials.git +git clone git://github.com/sbounmy/spree_essentials.git cd spree_essentials bundle install bundle exec dummier -rake -``` +rake test +``` + - ------------------------------------------------------------------------------ Demo ------------------------------------------------------------------------------ You can easily use the test/dummy app as a demo of spree_essentials. Just `cd` to where you develop and run: - -```bash -git clone git://github.com/citrus/spree_essentials.git + +```bash +git clone git://github.com/sbounmy/spree_essentials.git cd spree_essentials cp test/dummy_hooks/after_migrate.rb.sample test/dummy_hooks/after_migrate.rb bundle install @@ -203,7 +191,7 @@ cd test/dummy rails s ``` - + ------------------------------------------------------------------------------ To Do ------------------------------------------------------------------------------ @@ -217,7 +205,7 @@ Change Log **0.50.0 - 2012/5/1** -* Depend on Spree 1.1.0 +* Depend on Spree 1.1.0 * Remove `add_attachment_file_size_to_assets` migration @@ -239,7 +227,7 @@ Change Log * Use rails engine conventions for installation * Remove shared InstallGenerator class * Improved test coverage -* Added test/spree_essential_example +* Added test/spree_essential_example **0.40.0.rc2, 0.3.3 - 2012/1/20** @@ -261,7 +249,7 @@ Change Log **0.3.1 - 2011/12/13** * Fix broken markitup editor -* Rework 'selected' class on content tab +* Rework 'selected' class on content tab **0.3.0 - 2011/12/13** diff --git a/Versionfile b/Versionfile index 66b041f..a2a7e9a 100644 --- a/Versionfile +++ b/Versionfile @@ -1,3 +1,4 @@ +"1.2.x" => { :version => "0.6.0" } "1.1.x" => { :version => "0.5.0" } "1.0.x" => { :version => "0.4.0" } "0.70.x" => { :version => "0.3.2" } diff --git a/app/controllers/spree/admin/uploads_controller.rb b/app/controllers/spree/admin/uploads_controller.rb index 03b6201..ce1ec0f 100644 --- a/app/controllers/spree/admin/uploads_controller.rb +++ b/app/controllers/spree/admin/uploads_controller.rb @@ -1,16 +1,20 @@ class Spree::Admin::UploadsController < Spree::Admin::ResourceController - + def index render :template => "spree/admin/uploads/#{request.xhr? ? 'picker' : 'index'}", :layout => !request.xhr? end - + private - + def collection params[:q] ||= {} - params[:q][:sort] ||= "created_at.desc" + params[:q][:sorts] ||= "attachment_updated_at desc" @search = Spree::Upload.search(params[:q]) - @collection = @search.result.page(params[:page]).per(Spree::Config[:orders_per_page]) + if request.xhr? + @collection = @search.result + else + @collection = @search.result.page(params[:page]).per(Spree::Config[:orders_per_page]) + end end end diff --git a/app/helpers/spree/admin/spree_essentials_helper.rb b/app/helpers/spree/admin/spree_essentials_helper.rb index af98a22..d932013 100644 --- a/app/helpers/spree/admin/spree_essentials_helper.rb +++ b/app/helpers/spree/admin/spree_essentials_helper.rb @@ -1,31 +1,31 @@ module Spree::Admin::SpreeEssentialsHelper - + def inside_contents_tab? @inside_contents_tab ||= !request.fullpath.scan(Regexp.new(extension_routes.join("|"))).empty? end - + def contents_tab - content_tag :li, :class => inside_contents_tab? ? 'selected' : nil do - link_to I18n.t('spree.admin.shared.contents_tab.content'), extension_routes.first + content_tag :li, :class => inside_contents_tab? ? 'selected tab-with-icon' : 'tab-with-icon' do + link_to_with_icon 'icon-book', Spree.t('admin.shared.contents_tab.content'), extension_routes.first end end - + def markdown_helper content_tag('em', :class => 'small markdown-helper') do - [ - t('essentials.parsed_with'), + [ + Spree.t('essentials.parsed_with'), link_to("Markdown", "http://daringfireball.net/projects/markdown/basics", :onclick => 'window.open(this.href); return false') ].join(" ").html_safe end end private - + def extension_routes @extension_routes ||= SpreeEssentials.essentials.map { |key, cls| route = cls.tab[:route] || "admin_#{key}" - send("#{route}_path") rescue "##{key}" - }.push(spree.admin_uploads_path) + send("#{route}_path") rescue "##{key}" + }.push(spree.admin_uploads_path) end - + end diff --git a/app/models/spree/upload.rb b/app/models/spree/upload.rb index e61d093..f1ff891 100644 --- a/app/models/spree/upload.rb +++ b/app/models/spree/upload.rb @@ -2,8 +2,6 @@ class Spree::Upload < ::Spree::Asset attr_accessible :attachment, :alt - default_scope where(:type => "Upload") if table_exists? - validate :no_attachement_errors has_attached_file :attachment, diff --git a/app/overrides/admin/spree_essentials.rb b/app/overrides/admin/spree_essentials.rb index 917fb24..a230cfe 100644 --- a/app/overrides/admin/spree_essentials.rb +++ b/app/overrides/admin/spree_essentials.rb @@ -8,6 +8,6 @@ # Adds the contents menu. Inside the contents sub menu we ensure it's needed Deface::Override.new(:virtual_path => "spree/layouts/admin", :name => "spree_essential_contents_menu", - :insert_top => "#sub-menu[data-hook]", + :insert_before => "code[erb-silent]:contains('content_for?(:sub_menu)')", :partial => "spree/admin/shared/contents_sub_menu", :disabled => false) diff --git a/app/views/spree/admin/shared/_contents_sub_menu.html.erb b/app/views/spree/admin/shared/_contents_sub_menu.html.erb index 2945da6..2be3c5c 100644 --- a/app/views/spree/admin/shared/_contents_sub_menu.html.erb +++ b/app/views/spree/admin/shared/_contents_sub_menu.html.erb @@ -1,6 +1,6 @@ <% if inside_contents_tab? %> <% content_for :sub_menu do %> -