From 945bc8661affbfde7b086ed832489534e27eb130 Mon Sep 17 00:00:00 2001 From: Jeff Dutil Date: Mon, 1 Dec 2014 21:43:35 -0500 Subject: [PATCH] Bring in kaminari templates. --- frontend/.rspec | 1 - frontend/Gemfile | 4 ++-- .../twitter-bootstrap-3/_first_page.html.erb | 13 ++++++++++ .../twitter-bootstrap-3/_gap.html.erb | 8 +++++++ .../twitter-bootstrap-3/_last_page.html.erb | 13 ++++++++++ .../twitter-bootstrap-3/_next_page.html.erb | 13 ++++++++++ .../twitter-bootstrap-3/_page.html.erb | 12 ++++++++++ .../twitter-bootstrap-3/_paginator.html.erb | 24 +++++++++++++++++++ .../twitter-bootstrap-3/_prev_page.html.erb | 13 ++++++++++ frontend/spec/features/checkout_spec.rb | 2 +- frontend/spec/features/products_spec.rb | 6 ++--- .../spec/features/template_rendering_spec.rb | 3 +-- frontend/spree_frontend.gemspec | 12 ++++------ 13 files changed, 108 insertions(+), 16 deletions(-) delete mode 100644 frontend/.rspec create mode 100755 frontend/app/views/kaminari/twitter-bootstrap-3/_first_page.html.erb create mode 100755 frontend/app/views/kaminari/twitter-bootstrap-3/_gap.html.erb create mode 100755 frontend/app/views/kaminari/twitter-bootstrap-3/_last_page.html.erb create mode 100755 frontend/app/views/kaminari/twitter-bootstrap-3/_next_page.html.erb create mode 100755 frontend/app/views/kaminari/twitter-bootstrap-3/_page.html.erb create mode 100755 frontend/app/views/kaminari/twitter-bootstrap-3/_paginator.html.erb create mode 100755 frontend/app/views/kaminari/twitter-bootstrap-3/_prev_page.html.erb diff --git a/frontend/.rspec b/frontend/.rspec deleted file mode 100644 index 5052887a0fb..00000000000 --- a/frontend/.rspec +++ /dev/null @@ -1 +0,0 @@ ---color \ No newline at end of file diff --git a/frontend/Gemfile b/frontend/Gemfile index 49bfb5b7790..13f166ada73 100644 --- a/frontend/Gemfile +++ b/frontend/Gemfile @@ -1,6 +1,6 @@ eval(File.read(File.dirname(__FILE__) + '/../common_spree_dependencies.rb')) -gem 'spree_core', :path => '../core' -gem 'spree_api', :path => '../api' +gem 'spree_core', path: '../core' +gem 'spree_api', path: '../api' gemspec diff --git a/frontend/app/views/kaminari/twitter-bootstrap-3/_first_page.html.erb b/frontend/app/views/kaminari/twitter-bootstrap-3/_first_page.html.erb new file mode 100755 index 00000000000..f7e98460e53 --- /dev/null +++ b/frontend/app/views/kaminari/twitter-bootstrap-3/_first_page.html.erb @@ -0,0 +1,13 @@ +<%# Link to the "First" page + - available local variables + url: url to the first page + current_page: a page object for the currently displayed page + num_pages: total number of pages + per_page: number of items to fetch per page + remote: data-remote +-%> +<% unless current_page.first? %> +
  • + <%= link_to_unless current_page.first?, raw(t 'views.pagination.first'), url, :remote => remote %> +
  • +<% end %> \ No newline at end of file diff --git a/frontend/app/views/kaminari/twitter-bootstrap-3/_gap.html.erb b/frontend/app/views/kaminari/twitter-bootstrap-3/_gap.html.erb new file mode 100755 index 00000000000..2bcc5228005 --- /dev/null +++ b/frontend/app/views/kaminari/twitter-bootstrap-3/_gap.html.erb @@ -0,0 +1,8 @@ +<%# Non-link tag that stands for skipped pages... + - available local variables + current_page: a page object for the currently displayed page + num_pages: total number of pages + per_page: number of items to fetch per page + remote: data-remote +-%> +
  • <%= raw(t 'views.pagination.truncate') %>
  • \ No newline at end of file diff --git a/frontend/app/views/kaminari/twitter-bootstrap-3/_last_page.html.erb b/frontend/app/views/kaminari/twitter-bootstrap-3/_last_page.html.erb new file mode 100755 index 00000000000..e27c2a73d89 --- /dev/null +++ b/frontend/app/views/kaminari/twitter-bootstrap-3/_last_page.html.erb @@ -0,0 +1,13 @@ +<%# Link to the "Last" page + - available local variables + url: url to the last page + current_page: a page object for the currently displayed page + num_pages: total number of pages + per_page: number of items to fetch per page + remote: data-remote +-%> +<% unless current_page.last? %> + +<% end %> diff --git a/frontend/app/views/kaminari/twitter-bootstrap-3/_next_page.html.erb b/frontend/app/views/kaminari/twitter-bootstrap-3/_next_page.html.erb new file mode 100755 index 00000000000..7bccfdc1b35 --- /dev/null +++ b/frontend/app/views/kaminari/twitter-bootstrap-3/_next_page.html.erb @@ -0,0 +1,13 @@ +<%# Link to the "Next" page + - available local variables + url: url to the next page + current_page: a page object for the currently displayed page + num_pages: total number of pages + per_page: number of items to fetch per page + remote: data-remote +-%> +<% unless current_page.last? %> +
  • + <%= link_to_unless current_page.last?, raw(t 'views.pagination.next'), url, :rel => 'next', :remote => remote %> +
  • +<% end %> diff --git a/frontend/app/views/kaminari/twitter-bootstrap-3/_page.html.erb b/frontend/app/views/kaminari/twitter-bootstrap-3/_page.html.erb new file mode 100755 index 00000000000..3cf4a8ed851 --- /dev/null +++ b/frontend/app/views/kaminari/twitter-bootstrap-3/_page.html.erb @@ -0,0 +1,12 @@ +<%# Link showing page number + - available local variables + page: a page object for "this" page + url: url to this page + current_page: a page object for the currently displayed page + num_pages: total number of pages + per_page: number of items to fetch per page + remote: data-remote +-%> +
  • + <%= link_to page, url, opts = {:remote => remote, :rel => page.next? ? 'next' : page.prev? ? 'prev' : nil} %> +
  • diff --git a/frontend/app/views/kaminari/twitter-bootstrap-3/_paginator.html.erb b/frontend/app/views/kaminari/twitter-bootstrap-3/_paginator.html.erb new file mode 100755 index 00000000000..1fb25e27842 --- /dev/null +++ b/frontend/app/views/kaminari/twitter-bootstrap-3/_paginator.html.erb @@ -0,0 +1,24 @@ +<%# The container tag + - available local variables + current_page: a page object for the currently displayed page + num_pages: total number of pages + per_page: number of items to fetch per page + remote: data-remote + paginator: the paginator that renders the pagination tags inside +-%> +<%- pagination_class ||= '' %> +<%= paginator.render do -%> + +<% end -%> diff --git a/frontend/app/views/kaminari/twitter-bootstrap-3/_prev_page.html.erb b/frontend/app/views/kaminari/twitter-bootstrap-3/_prev_page.html.erb new file mode 100755 index 00000000000..336073b563c --- /dev/null +++ b/frontend/app/views/kaminari/twitter-bootstrap-3/_prev_page.html.erb @@ -0,0 +1,13 @@ +<%# Link to the "Previous" page + - available local variables + url: url to the previous page + current_page: a page object for the currently displayed page + num_pages: total number of pages + per_page: number of items to fetch per page + remote: data-remote +-%> +<% unless current_page.first? %> + +<% end %> diff --git a/frontend/spec/features/checkout_spec.rb b/frontend/spec/features/checkout_spec.rb index 0c059a5954a..d6158f12cf2 100644 --- a/frontend/spec/features/checkout_spec.rb +++ b/frontend/spec/features/checkout_spec.rb @@ -108,7 +108,7 @@ allow_any_instance_of(Spree::CheckoutController).to receive_messages(:try_spree_current_user => user) end - it "redirects to payment page", js: true do + it "redirects to payment page", inaccessible: true, js: true do visit spree.checkout_state_path(:delivery) click_button "Save and Continue" choose "Credit Card" diff --git a/frontend/spec/features/products_spec.rb b/frontend/spec/features/products_spec.rb index 28a1e9af982..de9504018e5 100644 --- a/frontend/spec/features/products_spec.rb +++ b/frontend/spec/features/products_spec.rb @@ -22,7 +22,7 @@ describe 'meta tags and title' do let(:jersey) { Spree::Product.find_by_name('Ruby on Rails Baseball Jersey') } - let(:metas) { { :meta_description => 'Brand new Ruby on Rails Jersey', :meta_title => 'Ruby on Rails Baseball Jersey Buy High Quality Geek Apparel', :meta_keywords => 'ror, jersey, ruby' } } + let(:metas) { { meta_description: 'Brand new Ruby on Rails Jersey', meta_title: 'Ruby on Rails Baseball Jersey Buy High Quality Geek Apparel', meta_keywords: 'ror, jersey, ruby' } } it 'should return the correct title when displaying a single product' do click_link jersey.name @@ -105,7 +105,7 @@ visit spree.product_path(product) click_button "Add To Cart" click_button "Checkout" - fill_in "order_email", :with => "test@example.com" + fill_in "order_email", with: "test@example.com" click_button 'Continue' within("tr[data-hook=item_total]") do expect(page).to have_content("руб19.99") @@ -115,7 +115,7 @@ end it "should be able to search for a product" do - fill_in "keywords", :with => "shirt" + fill_in "keywords", with: "shirt" click_button "Search" expect(page.all('#products .product-list-item').size).to eq(1) diff --git a/frontend/spec/features/template_rendering_spec.rb b/frontend/spec/features/template_rendering_spec.rb index 52b80ff380c..1cde9fd3cff 100644 --- a/frontend/spec/features/template_rendering_spec.rb +++ b/frontend/spec/features/template_rendering_spec.rb @@ -1,6 +1,6 @@ require 'spec_helper' -describe "Template rendering", :type => :feature do +describe "Template rendering", type: :feature do after do Capybara.ignore_hidden_elements = true @@ -16,5 +16,4 @@ visit spree.root_path expect(find('link[rel=canonical]')[:href]).to eql('http://spreestore.example.com/') end - end diff --git a/frontend/spree_frontend.gemspec b/frontend/spree_frontend.gemspec index b6636bd8cf3..a09174fdced 100644 --- a/frontend/spree_frontend.gemspec +++ b/frontend/spree_frontend.gemspec @@ -6,25 +6,23 @@ Gem::Specification.new do |s| s.name = 'spree_frontend' s.version = version s.summary = 'Frontend e-commerce functionality for the Spree project.' - s.description = 'Required dependency for Spree' + s.description = s.summary s.author = 'Sean Schofield' s.email = 'sean@spreecommerce.com' s.homepage = 'http://spreecommerce.com' - s.rubyforge_project = 'spree_frontend' - s.files = Dir['LICENSE', 'README.md', 'app/**/*', 'config/**/*', 'lib/**/*', 'db/**/*', 'vendor/**/*'] + s.files = `git ls-files`.split("\n") + s.test_files = `git ls-files -- {test,spec,features}/*`.split("\n") s.require_path = 'lib' s.requirements << 'none' s.add_dependency 'spree_api', version s.add_dependency 'spree_core', version + s.add_dependency 'bootstrap-sass', '~> 3.2.0' s.add_dependency 'canonical-rails', '~> 0.0.4' - s.add_dependency 'jquery-rails', '~> 3.1.2' - - s.add_runtime_dependency 'bootstrap-sass', '~> 3.2.0' - s.add_runtime_dependency 'bootstrap-kaminari-views', '~> 0.0.3' + s.add_dependency 'jquery-rails', '~> 3.1.2' s.add_development_dependency 'capybara-accessible' end