Skip to content
This repository was archived by the owner on Oct 24, 2023. It is now read-only.
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
26 commits
Select commit Hold shift + click to select a range
d1cb537
if ajax request, do not paginate
sbounmy Sep 30, 2012
109d7ed
Update version, added spree_auth_devise for testing.
Ben-M Oct 21, 2012
a0de02f
complete version bump
Ben-M Oct 22, 2012
b033c7b
update after_migrate hooks to seed an admin user
Ben-M Oct 22, 2012
cd352a6
Remove spree_auth_devise dependency
radar Oct 24, 2012
0045ea9
Add stub_authorization! helper and use it in extension_integration_test
radar Oct 24, 2012
7ff346d
Require sass-rails and jquery-rails gems as development dependencies
radar Oct 24, 2012
f09bd19
Specify jquery dependencies inside admin/all.js template
radar Oct 24, 2012
375da5c
Remove commented out line from extension_integration_test
radar Oct 24, 2012
d169b9f
Stub authorization inside markdown and upload integration tests
radar Oct 24, 2012
4e484cc
Correct tests in upload_integration_test
radar Oct 24, 2012
82aad76
spree 1-2-stable compliant however integration test fails
sbounmy Oct 31, 2012
711ea78
added legacy user initializer to dummy hook
sbounmy Oct 31, 2012
b3a7953
bump spree 1.3
sbounmy Dec 19, 2012
a05ca0d
fix : sorting with ransack and fully support spree 1.3 new admin
sbounmy Feb 23, 2013
ddb6a04
added icon book
sbounmy Feb 23, 2013
c545231
fix gem dependency
xmpolaris Apr 17, 2013
10274cd
fix uploads model sti issue
xmpolaris Apr 17, 2013
7a022d6
fix all specs and bump to capybara 2.1
sbounmy Aug 21, 2013
5d7000a
support spree 2.0.X
sbounmy Aug 22, 2013
b3c7853
use transaction fixtures with shared connection
sbounmy Aug 23, 2013
8fb594f
removed ruby 1.8.7 from travis ( not supported )
sbounmy Aug 23, 2013
544b0b0
removed 1.9.2 aswell capybara and spree 2.0.0 >= 1.9.3
sbounmy Aug 23, 2013
31ab226
removed ree from travis aswell
sbounmy Aug 23, 2013
4f9f73b
update readme
sbounmy Aug 24, 2013
89711d2
update readme
sbounmy Aug 24, 2013
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -8,3 +8,4 @@ Gemfile.lock
pkg/*
test/dummy_hooks/after_migrate.rb
test/dummy
.sass-cache
3 changes: 0 additions & 3 deletions .travis.yml
Original file line number Diff line number Diff line change
@@ -1,8 +1,5 @@
rvm:
- 1.8.7
- 1.9.2
- 1.9.3
- ree

before_script:
- "sh -e /etc/init.d/xvfb start"
Expand Down
2 changes: 1 addition & 1 deletion Gemfile
Original file line number Diff line number Diff line change
Expand Up @@ -3,4 +3,4 @@ gemspec

group :development, :test do
gem "spree_essential_example", :path => "test/spree_essential_example"
end
end
66 changes: 27 additions & 39 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
# Spree Essentials [![Build Status](https://secure.travis-ci.org/citrus/spree_essentials.png)](http://travis-ci.org/citrus/spree_essentials)
# Spree Essentials [![Build Status](https://secure.travis-ci.org/sbounmy/spree_essentials.png)](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 ;)

Expand All @@ -12,62 +12,50 @@ 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
------------------------------------------------------------------------------

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
```

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
Expand Down Expand Up @@ -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'),
Expand All @@ -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.


------------------------------------------------------------------------------
Expand All @@ -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
Expand All @@ -203,7 +191,7 @@ cd test/dummy
rails s
```


------------------------------------------------------------------------------
To Do
------------------------------------------------------------------------------
Expand All @@ -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


Expand All @@ -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**
Expand All @@ -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**
Expand Down
1 change: 1 addition & 0 deletions Versionfile
Original file line number Diff line number Diff line change
@@ -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" }
Expand Down
14 changes: 9 additions & 5 deletions app/controllers/spree/admin/uploads_controller.rb
Original file line number Diff line number Diff line change
@@ -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
22 changes: 11 additions & 11 deletions app/helpers/spree/admin/spree_essentials_helper.rb
Original file line number Diff line number Diff line change
@@ -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
2 changes: 0 additions & 2 deletions app/models/spree/upload.rb
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand Down
2 changes: 1 addition & 1 deletion app/overrides/admin/spree_essentials.rb
Original file line number Diff line number Diff line change
Expand Up @@ -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)
2 changes: 1 addition & 1 deletion app/views/spree/admin/shared/_contents_sub_menu.html.erb
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
<% if inside_contents_tab? %>
<% content_for :sub_menu do %>
<ul id="sub_nav" data-hook="essentials_sub_nav">
<ul id="sub_nav" data-hook="essentials_sub_nav" class="inline-menu">
<% SpreeEssentials.essentials.each_pair do |name, cls| %>
<%= tab *cls.sub_tab if defined?(cls.sub_tab) %>
<% end %>
Expand Down
25 changes: 17 additions & 8 deletions app/views/spree/admin/uploads/_form.html.erb
Original file line number Diff line number Diff line change
@@ -1,8 +1,17 @@
<p>
<%= form.label :attachment %>:<br/>
<%= form.file_field :attachment %>
</p>
<p>
<%= form.label :alt, t('description') %>:<br/>
<%= form.text_field :alt, :class => 'text' %>
</p>
<div data-hook="admin_upload_form_fields">
<div class="left eight columns alpha" data-hook="admin_product_form_left">
<%= form.field_container :attachment do %>
<%= form.label :attachment %>
<%= form.file_field :attachment %>
<%= form.error_message_on :attachment %>
<% end %>
</div>

<div class="left eight columns alpha" data-hook="admin_product_form_left">
<%= form.field_container :attachment do %>
<%= form.label :alt, t('description') %>
<%= form.text_field :alt, :class => 'text' %>
<%= form.error_message_on :attachment %>
<% end %>
</div>
</div>
1 change: 0 additions & 1 deletion app/views/spree/admin/uploads/edit.html.erb
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,6 @@
<% end %>
</p>
<%= render "form", :form => f %>
</table>
<p class="form-buttons">
<%= button t("update") %>
or <%= link_to t("cancel"), admin_uploads_url, :id => "cancel_link" %>
Expand Down
Loading