refinerycms-whatson 1.8.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- data/.gitignore +48 -0
- data/.tork.rb +2 -0
- data/.travis.yml +2 -0
- data/Gemfile +7 -0
- data/Rakefile +3 -0
- data/app/controllers/admin/whatson/categories_controller.rb +11 -0
- data/app/controllers/admin/whatson/comments_controller.rb +40 -0
- data/app/controllers/admin/whatson/posts_controller.rb +97 -0
- data/app/controllers/admin/whatson/settings_controller.rb +53 -0
- data/app/controllers/whatson/categories_controller.rb +13 -0
- data/app/controllers/whatson/posts_controller.rb +109 -0
- data/app/controllers/whatson_controller.rb +16 -0
- data/app/helpers/whatson_posts_helper.rb +56 -0
- data/app/mailers/whatson/comment_mailer.rb +13 -0
- data/app/models/categorization.rb +7 -0
- data/app/models/whatson/comment_mailer.rb +1 -0
- data/app/models/whatson_category.rb +19 -0
- data/app/models/whatson_comment.rb +137 -0
- data/app/models/whatson_post.rb +114 -0
- data/app/views/admin/whatson/_submenu.html.erb +96 -0
- data/app/views/admin/whatson/categories/_category.html.erb +16 -0
- data/app/views/admin/whatson/categories/_form.html.erb +19 -0
- data/app/views/admin/whatson/categories/_sortable_list.html.erb +7 -0
- data/app/views/admin/whatson/categories/edit.html.erb +1 -0
- data/app/views/admin/whatson/categories/index.html.erb +26 -0
- data/app/views/admin/whatson/categories/new.html.erb +1 -0
- data/app/views/admin/whatson/comments/_comment.html.erb +20 -0
- data/app/views/admin/whatson/comments/_sortable_list.html.erb +7 -0
- data/app/views/admin/whatson/comments/index.html.erb +35 -0
- data/app/views/admin/whatson/comments/show.html.erb +63 -0
- data/app/views/admin/whatson/posts/_form.css.erb +20 -0
- data/app/views/admin/whatson/posts/_form.html.erb +110 -0
- data/app/views/admin/whatson/posts/_form.js.erb +23 -0
- data/app/views/admin/whatson/posts/_form_part.html.erb +3 -0
- data/app/views/admin/whatson/posts/_post.html.erb +24 -0
- data/app/views/admin/whatson/posts/_sortable_list.html.erb +7 -0
- data/app/views/admin/whatson/posts/_teaser_part.html.erb +11 -0
- data/app/views/admin/whatson/posts/edit.html.erb +1 -0
- data/app/views/admin/whatson/posts/index.html.erb +28 -0
- data/app/views/admin/whatson/posts/new.html.erb +1 -0
- data/app/views/admin/whatson/posts/uncategorized.html.erb +26 -0
- data/app/views/admin/whatson/settings/notification_recipients.html.erb +24 -0
- data/app/views/shared/admin/_autocomplete.html.erb +55 -0
- data/app/views/whatson/categories/show.html.erb +21 -0
- data/app/views/whatson/comment_mailer/notification.html.erb +17 -0
- data/app/views/whatson/posts/_comment.html.erb +10 -0
- data/app/views/whatson/posts/_nav.html.erb +11 -0
- data/app/views/whatson/posts/archive.html.erb +20 -0
- data/app/views/whatson/posts/index.html.erb +24 -0
- data/app/views/whatson/posts/index.rss.builder +17 -0
- data/app/views/whatson/posts/show.html.erb +98 -0
- data/app/views/whatson/posts/tagged.html.erb +22 -0
- data/app/views/whatson/shared/_archive_list.html.erb +9 -0
- data/app/views/whatson/shared/_categories.html.erb +10 -0
- data/app/views/whatson/shared/_post.html.erb +46 -0
- data/app/views/whatson/shared/_related_posts.html.erb +10 -0
- data/app/views/whatson/shared/_rss_feed.html.erb +2 -0
- data/app/views/whatson/shared/_tags.html.erb +8 -0
- data/config/locales/bg.yml +158 -0
- data/config/locales/cs.yml +128 -0
- data/config/locales/de.yml +130 -0
- data/config/locales/en.yml +159 -0
- data/config/locales/es.yml +159 -0
- data/config/locales/fr.yml +154 -0
- data/config/locales/it.yml +156 -0
- data/config/locales/ja.yml +159 -0
- data/config/locales/nb.yml +30 -0
- data/config/locales/nl.yml +134 -0
- data/config/locales/pl.yml +134 -0
- data/config/locales/pt-BR.yml +143 -0
- data/config/locales/ru.yml +135 -0
- data/config/locales/sk.yml +128 -0
- data/config/locales/zh-CN.yml +128 -0
- data/config/routes.rb +47 -0
- data/db/migrate/1_create_whatson_structure.rb +54 -0
- data/db/migrate/2_add_user_id_to_whatson_posts.rb +11 -0
- data/db/migrate/3_acts_as_taggable_on_migration.rb +28 -0
- data/db/migrate/4_create_seo_meta_for_whatson.rb +25 -0
- data/db/migrate/5_add_cached_slugs.rb +11 -0
- data/db/migrate/6_add_custom_url_field_to_whatson_posts.rb +9 -0
- data/db/migrate/7_add_custom_teaser_field_to_whatson_posts.rb +10 -0
- data/db/migrate/8_add_primary_key_to_categorizations.rb +12 -0
- data/db/seeds/refinerycms_whatson.rb +20 -0
- data/features/authors.feature +15 -0
- data/features/category.feature +23 -0
- data/features/support/factories/whatson_categories.rb +5 -0
- data/features/support/factories/whatson_comments.rb +8 -0
- data/features/support/factories/whatson_posts.rb +9 -0
- data/features/support/paths.rb +24 -0
- data/features/support/step_definitions/authors_steps.rb +7 -0
- data/features/support/step_definitions/category_steps.rb +11 -0
- data/features/support/step_definitions/tags_steps.rb +13 -0
- data/features/tags.feature +26 -0
- data/lib/gemspec.rb +37 -0
- data/lib/generators/refinerycms_whatson_generator.rb +8 -0
- data/lib/refinery/whatson/tabs.rb +28 -0
- data/lib/refinery/whatson/version.rb +17 -0
- data/lib/refinerycms-whatson.rb +41 -0
- data/public/images/refinerycms-whatson/icons/cog.png +0 -0
- data/public/images/refinerycms-whatson/icons/comment.png +0 -0
- data/public/images/refinerycms-whatson/icons/comment_cross.png +0 -0
- data/public/images/refinerycms-whatson/icons/comment_tick.png +0 -0
- data/public/images/refinerycms-whatson/icons/comments.png +0 -0
- data/public/images/refinerycms-whatson/icons/down.gif +0 -0
- data/public/images/refinerycms-whatson/icons/folder.png +0 -0
- data/public/images/refinerycms-whatson/icons/folder_add.png +0 -0
- data/public/images/refinerycms-whatson/icons/folder_edit.png +0 -0
- data/public/images/refinerycms-whatson/icons/page.png +0 -0
- data/public/images/refinerycms-whatson/icons/page_add.png +0 -0
- data/public/images/refinerycms-whatson/icons/page_copy.png +0 -0
- data/public/images/refinerycms-whatson/icons/up.gif +0 -0
- data/public/images/refinerycms-whatson/rss-feed.png +0 -0
- data/public/javascripts/refinery/refinerycms-whatson.js +50 -0
- data/public/javascripts/refinerycms-whatson.js +25 -0
- data/public/stylesheets/refinery/refinerycms-whatson.css +57 -0
- data/public/stylesheets/refinerycms-whatson.css +93 -0
- data/public/stylesheets/ui-lightness/images/ui-bg_diagonals-thick_18_b81900_40x40.png +0 -0
- data/public/stylesheets/ui-lightness/images/ui-bg_diagonals-thick_20_666666_40x40.png +0 -0
- data/public/stylesheets/ui-lightness/images/ui-bg_flat_10_000000_40x100.png +0 -0
- data/public/stylesheets/ui-lightness/images/ui-bg_glass_100_f6f6f6_1x400.png +0 -0
- data/public/stylesheets/ui-lightness/images/ui-bg_glass_100_fdf5ce_1x400.png +0 -0
- data/public/stylesheets/ui-lightness/images/ui-bg_glass_65_ffffff_1x400.png +0 -0
- data/public/stylesheets/ui-lightness/images/ui-bg_gloss-wave_35_f6a828_500x100.png +0 -0
- data/public/stylesheets/ui-lightness/images/ui-bg_highlight-soft_100_eeeeee_1x100.png +0 -0
- data/public/stylesheets/ui-lightness/images/ui-bg_highlight-soft_75_ffe45c_1x100.png +0 -0
- data/public/stylesheets/ui-lightness/images/ui-icons_222222_256x240.png +0 -0
- data/public/stylesheets/ui-lightness/images/ui-icons_228ef1_256x240.png +0 -0
- data/public/stylesheets/ui-lightness/images/ui-icons_ef8c08_256x240.png +0 -0
- data/public/stylesheets/ui-lightness/images/ui-icons_ffd27a_256x240.png +0 -0
- data/public/stylesheets/ui-lightness/images/ui-icons_ffffff_256x240.png +0 -0
- data/public/stylesheets/ui-lightness/jquery-ui-1.8.13.custom.css +330 -0
- data/readme.md +41 -0
- data/refinerycms-whatson.gemspec +18 -0
- data/spec/models/whatson_category_spec.rb +41 -0
- data/spec/models/whatson_comment_spec.rb +21 -0
- data/spec/models/whatson_post_spec.rb +217 -0
- metadata +235 -0
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
class AddPrimaryKeyToCategorizations < ActiveRecord::Migration
|
|
2
|
+
def self.up
|
|
3
|
+
unless ::Categorization.column_names.include?("id")
|
|
4
|
+
add_column :whatson_categories_whatson_posts, :id, :primary_key
|
|
5
|
+
end
|
|
6
|
+
end
|
|
7
|
+
|
|
8
|
+
def self.down
|
|
9
|
+
remove_column :whatson_categories_whatson_posts, :id
|
|
10
|
+
end
|
|
11
|
+
end
|
|
12
|
+
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
::User.find(:all).each do |user|
|
|
2
|
+
if user.plugins.where(:name => 'refinerycms_whatson').blank?
|
|
3
|
+
user.plugins.create(:name => "refinerycms_whatson",
|
|
4
|
+
:position => (user.plugins.maximum(:position) || -1) +1)
|
|
5
|
+
end
|
|
6
|
+
end if defined?(::User)
|
|
7
|
+
|
|
8
|
+
if defined?(::Page)
|
|
9
|
+
page = ::Page.create(
|
|
10
|
+
:title => "Whatson",
|
|
11
|
+
:link_url => "/whatson",
|
|
12
|
+
:deletable => false,
|
|
13
|
+
:position => ((Page.maximum(:position, :conditions => {:parent_id => nil}) || -1)+1),
|
|
14
|
+
:menu_match => "^/whatsons?(\/|\/.+?|)$"
|
|
15
|
+
)
|
|
16
|
+
|
|
17
|
+
::Page.default_parts.each do |default_page_part|
|
|
18
|
+
page.parts.create(:title => default_page_part, :body => nil)
|
|
19
|
+
end
|
|
20
|
+
end
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
@whatson @whatson_authors
|
|
2
|
+
Feature: Whatson Post Authors
|
|
3
|
+
Whatson posts can be assigned authors through the given user model
|
|
4
|
+
current_user is assumed through admin screens
|
|
5
|
+
|
|
6
|
+
Scenario: Saving a whatson post in whatson_posts#new associates the current_user as the author
|
|
7
|
+
Given I am a logged in refinery user
|
|
8
|
+
|
|
9
|
+
When I am on the new whatson post form
|
|
10
|
+
And I fill in "Title" with "This is my whatson post"
|
|
11
|
+
And I fill in "whatson_post_body" with "And I love it"
|
|
12
|
+
And I press "Save"
|
|
13
|
+
|
|
14
|
+
Then there should be 1 whatson post
|
|
15
|
+
And the whatson post should belong to me
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
@whatson @whatson_categories
|
|
2
|
+
Feature: Whatson Post Categories
|
|
3
|
+
Whatson posts can be assigned categories
|
|
4
|
+
|
|
5
|
+
Background:
|
|
6
|
+
Given I am a logged in refinery user
|
|
7
|
+
Given there is a category titled "Videos"
|
|
8
|
+
|
|
9
|
+
Scenario: The whatson post new/edit form has category_list
|
|
10
|
+
When I am on the new whatson post form
|
|
11
|
+
Then I should see "Tags"
|
|
12
|
+
Then I should see "Videos"
|
|
13
|
+
|
|
14
|
+
Scenario: The whatson post new/edit form saves categories
|
|
15
|
+
When I am on the new whatson post form
|
|
16
|
+
And I fill in "Title" with "This is my whatson post"
|
|
17
|
+
And I fill in "whatson_post_body" with "And I love it"
|
|
18
|
+
And I check "Videos"
|
|
19
|
+
And I press "Save"
|
|
20
|
+
|
|
21
|
+
Then there should be 1 whatson post
|
|
22
|
+
And the whatson post should have 1 category
|
|
23
|
+
And the whatson post should have the category "Videos"
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
require 'factory_girl'
|
|
2
|
+
|
|
3
|
+
Factory.define(:whatson_post, :class => WhatsonPost) do |f|
|
|
4
|
+
f.sequence(:title) { |n| "Top #{n} Shopping Centers in Chicago" }
|
|
5
|
+
f.body "These are the top ten shopping centers in Chicago. You're going to read a long whatson post about them. Come to peace with it."
|
|
6
|
+
f.draft false
|
|
7
|
+
f.tag_list "chicago, shopping, fun times"
|
|
8
|
+
f.published_at Time.now
|
|
9
|
+
end
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
module NavigationHelpers
|
|
2
|
+
module Refinery
|
|
3
|
+
module Whatson
|
|
4
|
+
def path_to(page_name)
|
|
5
|
+
case page_name
|
|
6
|
+
when /the list of whatson posts/
|
|
7
|
+
admin_whatson_posts_path
|
|
8
|
+
when /the new whatson posts? form/
|
|
9
|
+
new_admin_whatson_post_path
|
|
10
|
+
else
|
|
11
|
+
begin
|
|
12
|
+
if page_name =~ /the whatson post titled "?([^\"]*)"?/ and (page = WhatsonPost.find_by_title($1)).present?
|
|
13
|
+
self.url_for(page.url)
|
|
14
|
+
else
|
|
15
|
+
nil
|
|
16
|
+
end
|
|
17
|
+
rescue
|
|
18
|
+
nil
|
|
19
|
+
end
|
|
20
|
+
end
|
|
21
|
+
end
|
|
22
|
+
end
|
|
23
|
+
end
|
|
24
|
+
end
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
Given /^there is a category titled "([^"]*)"$/ do |title|
|
|
2
|
+
@category = Factory.create(:whatson_category, :title => title)
|
|
3
|
+
end
|
|
4
|
+
|
|
5
|
+
Then /^the whatson post should have ([\d]*) categor[yies]{1,3}$/ do |num_category|
|
|
6
|
+
WhatsonPost.last.categories.count.should == num_category.to_i
|
|
7
|
+
end
|
|
8
|
+
|
|
9
|
+
Then /^the whatson post should have the category "([^"]*)"$/ do |category|
|
|
10
|
+
WhatsonPost.last.categories.first.title.should == category
|
|
11
|
+
end
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
Given /^there is a whatson post titled "([^"]*)" and tagged "([^"]*)"$/ do |title, tag_name|
|
|
2
|
+
@whatson_post = Factory.create(:whatson_post, :title => title, :tag_list => tag_name)
|
|
3
|
+
end
|
|
4
|
+
|
|
5
|
+
When /^I visit the tagged posts page for "([^"]*)"$/ do |tag_name|
|
|
6
|
+
@whatson_post ||= Factory.create(:whatson_post, :tag_list => tag_name)
|
|
7
|
+
tag = WhatsonPost.tag_counts_on(:tags).first
|
|
8
|
+
visit tagged_posts_path(tag.id, tag_name.parameterize)
|
|
9
|
+
end
|
|
10
|
+
|
|
11
|
+
Then /^the whatson post should have the tags "([^"]*)"$/ do |tag_list|
|
|
12
|
+
WhatsonPost.last.tag_list == tag_list.split(', ')
|
|
13
|
+
end
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
@whatson @whatson_tags
|
|
2
|
+
Feature: Whatson Post Tags
|
|
3
|
+
Whatson posts can be assigned tags
|
|
4
|
+
|
|
5
|
+
Background:
|
|
6
|
+
Given I am a logged in refinery user
|
|
7
|
+
|
|
8
|
+
Scenario: The whatson post new/edit form has tag_list
|
|
9
|
+
When I am on the new whatson post form
|
|
10
|
+
Then I should see "Tags"
|
|
11
|
+
|
|
12
|
+
Scenario: The whatson post new/edit form saves tag_list
|
|
13
|
+
When I am on the new whatson post form
|
|
14
|
+
And I fill in "Title" with "This is my whatson post"
|
|
15
|
+
And I fill in "whatson_post_body" with "And I love it"
|
|
16
|
+
And I fill in "Tags" with "chicago, bikes, beers, babes"
|
|
17
|
+
And I press "Save"
|
|
18
|
+
|
|
19
|
+
Then there should be 1 whatson post
|
|
20
|
+
And the whatson post should have the tags "chicago, bikes, beers, babes"
|
|
21
|
+
|
|
22
|
+
Scenario: The whatson has a "tagged" route & view
|
|
23
|
+
Given there is a whatson post titled "I love my city" and tagged "chicago"
|
|
24
|
+
When I visit the tagged posts page for "chicago"
|
|
25
|
+
Then I should see "Chicago"
|
|
26
|
+
And I should see "I love my city"
|
data/lib/gemspec.rb
ADDED
|
@@ -0,0 +1,37 @@
|
|
|
1
|
+
#!/usr/bin/env ruby
|
|
2
|
+
require File.expand_path('../refinery/whatson/version', __FILE__)
|
|
3
|
+
version = ::Refinery::Whatson::Version.to_s
|
|
4
|
+
raise "Could not get version so gemspec can not be built" if version.nil?
|
|
5
|
+
files = Dir.glob("**/*").flatten.reject{|f| f =~ %r{.(gem|lock)$}}
|
|
6
|
+
|
|
7
|
+
gemspec = <<EOF
|
|
8
|
+
Gem::Specification.new do |s|
|
|
9
|
+
s.name = %q{refinerycms-whatson}
|
|
10
|
+
s.version = %q{#{version}}
|
|
11
|
+
s.description = %q{A really straightforward open source Ruby on Rails whatson engine designed for integration with RefineryCMS.}
|
|
12
|
+
s.date = %q{#{Time.now.strftime('%Y-%m-%d')}}
|
|
13
|
+
s.summary = %q{Ruby on Rails whatsonging engine for RefineryCMS.}
|
|
14
|
+
s.email = %q{info@refinerycms.com}
|
|
15
|
+
s.homepage = %q{http://refinerycms.com/whatson}
|
|
16
|
+
s.authors = ['Resolve Digital', 'Neoteric Design']
|
|
17
|
+
s.require_paths = %w(lib)
|
|
18
|
+
|
|
19
|
+
# Runtime dependencies
|
|
20
|
+
s.add_dependency 'refinerycms-core', '~> 1.0.3'
|
|
21
|
+
s.add_dependency 'filters_spam', '~> 0.2'
|
|
22
|
+
s.add_dependency 'acts-as-taggable-on'
|
|
23
|
+
s.add_dependency 'seo_meta', '~> 1.1.0'
|
|
24
|
+
|
|
25
|
+
# Development dependencies
|
|
26
|
+
s.add_development_dependency 'factory_girl'
|
|
27
|
+
|
|
28
|
+
s.files = %w(
|
|
29
|
+
#{files.join("\n ")}
|
|
30
|
+
)
|
|
31
|
+
#{"s.test_files = %w(
|
|
32
|
+
#{Dir.glob("test/**/*.rb").join("\n ")}
|
|
33
|
+
)" if File.directory?("test")}
|
|
34
|
+
end
|
|
35
|
+
EOF
|
|
36
|
+
|
|
37
|
+
File.open(File.expand_path("../../refinerycms-whatson.gemspec", __FILE__), 'w').puts(gemspec)
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
module Refinery
|
|
2
|
+
module Whatson
|
|
3
|
+
attr_accessor :tabs
|
|
4
|
+
|
|
5
|
+
def self.tabs
|
|
6
|
+
@tabs ||= []
|
|
7
|
+
end
|
|
8
|
+
|
|
9
|
+
class Tab
|
|
10
|
+
attr_accessor :name, :partial
|
|
11
|
+
|
|
12
|
+
def self.register(&block)
|
|
13
|
+
tab = self.new
|
|
14
|
+
|
|
15
|
+
yield tab
|
|
16
|
+
|
|
17
|
+
raise "A tab MUST have a name!: #{tab.inspect}" if tab.name.blank?
|
|
18
|
+
raise "A tab MUST have a partial!: #{tab.inspect}" if tab.partial.blank?
|
|
19
|
+
end
|
|
20
|
+
|
|
21
|
+
protected
|
|
22
|
+
|
|
23
|
+
def initialize
|
|
24
|
+
::Refinery::Whatson.tabs << self # add me to the collection of registered page tabs
|
|
25
|
+
end
|
|
26
|
+
end
|
|
27
|
+
end
|
|
28
|
+
end
|
|
@@ -0,0 +1,41 @@
|
|
|
1
|
+
require 'filters_spam'
|
|
2
|
+
|
|
3
|
+
module Refinery
|
|
4
|
+
module Whatson
|
|
5
|
+
autoload :Version, File.expand_path('../refinery/whatson/version', __FILE__)
|
|
6
|
+
autoload :Tab, File.expand_path("../refinery/whatson/tabs", __FILE__)
|
|
7
|
+
|
|
8
|
+
class << self
|
|
9
|
+
attr_accessor :root
|
|
10
|
+
def root
|
|
11
|
+
@root ||= Pathname.new(File.expand_path('../../', __FILE__))
|
|
12
|
+
end
|
|
13
|
+
|
|
14
|
+
def version
|
|
15
|
+
::Refinery::Whatson::Version.to_s
|
|
16
|
+
end
|
|
17
|
+
end
|
|
18
|
+
|
|
19
|
+
class Engine < Rails::Engine
|
|
20
|
+
initializer 'whatson serves assets' do |app|
|
|
21
|
+
app.middleware.insert_after ::ActionDispatch::Static, ::ActionDispatch::Static, "#{root}/public"
|
|
22
|
+
end
|
|
23
|
+
|
|
24
|
+
config.to_prepare do
|
|
25
|
+
require File.expand_path('../refinery/whatson/tabs', __FILE__)
|
|
26
|
+
end
|
|
27
|
+
|
|
28
|
+
config.after_initialize do
|
|
29
|
+
Refinery::Plugin.register do |plugin|
|
|
30
|
+
plugin.pathname = root
|
|
31
|
+
plugin.name = "refinerycms_whatson"
|
|
32
|
+
plugin.url = {:controller => '/admin/whatson/posts', :action => 'index'}
|
|
33
|
+
plugin.menu_match = /^\/?(admin|refinery)\/whatson\/?(posts|comments|categories)?/
|
|
34
|
+
plugin.activity = {
|
|
35
|
+
:class => WhatsonPost
|
|
36
|
+
}
|
|
37
|
+
end
|
|
38
|
+
end
|
|
39
|
+
end if defined?(Rails::Engine)
|
|
40
|
+
end
|
|
41
|
+
end
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
@@ -0,0 +1,50 @@
|
|
|
1
|
+
$(document).ready(function(){
|
|
2
|
+
$('nav#actions.multilist > ul:not(.search_list) li a[href$="' + window.location.pathname + '"]')
|
|
3
|
+
.parent().addClass('selected');
|
|
4
|
+
if($('nav#actions.multilist > ul:not(.search_list) li.selected').length == 0) {
|
|
5
|
+
$('nav#actions.multilist > ul:not(.search_list) li a:nth(1)').parent().addClass('selected');
|
|
6
|
+
}
|
|
7
|
+
|
|
8
|
+
$('nav#actions.multilist > ul:not(.search_list) li > a').each(function(i,a){
|
|
9
|
+
if ($(this).data('dialog-title') == null) {
|
|
10
|
+
$(this).bind('click', function(){
|
|
11
|
+
$(this).css('background-image', "url('/images/refinery/icons/ajax-loader.gif') !important");
|
|
12
|
+
});
|
|
13
|
+
}
|
|
14
|
+
});
|
|
15
|
+
|
|
16
|
+
$('ul.collapsible_menu').each(function(i, ul) {
|
|
17
|
+
(first_li = $(this).children('li:first')).after(div=$("<div></div>"));
|
|
18
|
+
|
|
19
|
+
$("<span class='arrow'> </span>").appendTo(first_li)
|
|
20
|
+
|
|
21
|
+
if (($(this).children('li.selected')).length == 0) {
|
|
22
|
+
div.hide();
|
|
23
|
+
first_li.addClass("closed");
|
|
24
|
+
}
|
|
25
|
+
$(this).children('li:not(:first)').appendTo(div);
|
|
26
|
+
|
|
27
|
+
first_li.find('> a, > span.arrow').click(function(e){
|
|
28
|
+
$(this).parent().toggleClass("closed");
|
|
29
|
+
$(this).parent().toggleClass("open");
|
|
30
|
+
|
|
31
|
+
$(this).parent().next('div').animate({
|
|
32
|
+
opacity: 'toggle'
|
|
33
|
+
, height: 'toggle'
|
|
34
|
+
}, 250, $.proxy(function(){
|
|
35
|
+
$(this).css('background-image', null);
|
|
36
|
+
}, $(this))
|
|
37
|
+
);
|
|
38
|
+
e.preventDefault();
|
|
39
|
+
});
|
|
40
|
+
});
|
|
41
|
+
|
|
42
|
+
$('.success_icon, .failure_icon').bind('click', function(e) {
|
|
43
|
+
$.get($(this).attr('href'), $.proxy(function(data){
|
|
44
|
+
$(this).css('background-image', null)
|
|
45
|
+
.removeClass('failure_icon').removeClass('success_icon')
|
|
46
|
+
.addClass(data.enabled ? 'success_icon' : 'failure_icon');
|
|
47
|
+
}, $(this)));
|
|
48
|
+
e.preventDefault();
|
|
49
|
+
});
|
|
50
|
+
});
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
$(document).ready(function(){
|
|
2
|
+
$('#show_whatson_post').height($('#show_whatson_post').height());
|
|
3
|
+
|
|
4
|
+
$('#next_prev_article a:not(".home")').live('click', function(){
|
|
5
|
+
url = this.href + ".js";
|
|
6
|
+
$('#show_whatson_post > *').fadeOut();
|
|
7
|
+
$.ajax({
|
|
8
|
+
url: url,
|
|
9
|
+
success: function(data) {
|
|
10
|
+
$('#show_whatson_post').html(data);
|
|
11
|
+
new_height = 0;
|
|
12
|
+
$('#show_whatson_post > *').each(function(){
|
|
13
|
+
new_height += $(this).height()
|
|
14
|
+
});
|
|
15
|
+
$('#show_whatson_post').animate({
|
|
16
|
+
height: new_height
|
|
17
|
+
});
|
|
18
|
+
}
|
|
19
|
+
});
|
|
20
|
+
$('html, body').animate({
|
|
21
|
+
scrollTop: $('body').offset().top
|
|
22
|
+
}, 2000);
|
|
23
|
+
return false;
|
|
24
|
+
})
|
|
25
|
+
})
|