Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

Merge pull request #339 from shalott/css_rewrite_fixes_16

last few fixes
  • Loading branch information...
commit 97e2706ad2516e84c5f1ff1d441a43be9d8ab78e 2 parents cda29d8 + 5c274d9
@shalott shalott authored
View
24 app/models/skin.rb
@@ -399,19 +399,29 @@ def self.load_site_css
end
full_title = "Archive #{version}: (#{position}) #{title}"
- skin = Skin.find_by_title_and_official(full_title, true)
+ skin = Skin.find_by_title(full_title)
if skin.nil?
- skin = Skin.new(:title => full_title, :filename => filename, :description => description, :public => true,
- :media => skin_media, :role => skin_role, :ie_condition => skin_ie, :unusable => true)
- File.open(version_dir + 'preview.png', 'rb') {|preview_file| skin.icon = preview_file}
- skin.official = true
- skin.save!
+ skin = Skin.new
end
+
+ # update the attributes
+ skin.title ||= full_title
+ skin.filename = filename
+ skin.description = description
+ skin.public = true
+ skin.media = skin_media
+ skin.role = skin_role
+ skin.ie_condition = skin_ie
+ skin.unusable = true
+ skin.official = true
+ File.open(version_dir + 'preview.png', 'rb') {|preview_file| skin.icon = preview_file}
+ skin.save!
+
skins << skin
end
# set up the parent relationship of all the skins in this version
- top_skin = Skin.find_by_title_and_official("Archive #{version}", true)
+ top_skin = Skin.find_by_title("Archive #{version}")
if top_skin
top_skin.clear_cache! if top_skin.cached?
top_skin.skin_parents.delete_all
View
8 app/models/skin_parent.rb
@@ -20,14 +20,14 @@ def no_circular_skin
if parent_skin == child_skin
errors.add(:base, ts("^You can't make a skin its own parent!"))
end
- if child_skin.parent_skins.value_of(:id).include?(parent_skin.id)
- errors.add(:base, ts("^%{parent_title} is already a parent of %{child_title}!", :child_title => child_skin.title, :parent_title => parent_skin.title))
+ if child_skin.parent_skins.include?(parent_skin)
+ errors.add(:base, ts("^%{parent_title} is already a parent of %{child_title}", :child_title => child_skin.title, :parent_title => parent_skin.title))
end
if parent_skin.get_all_parents.include?(child_skin)
- errors.add(:base, ts("^%{child_title} is one of the ancestors of %{parent_title}!", :child_title => child_skin.title, :parent_title => parent_skin.title))
+ errors.add(:base, ts("^%{child_title} is one of the ancestors of %{parent_title}", :child_title => child_skin.title, :parent_title => parent_skin.title))
end
if child_skin.get_all_parents.include?(parent_skin)
- errors.add(:base, ts("^%{parent_title} is one of the ancestors of %{child_title}!", :child_title => child_skin.title, :parent_title => parent_skin.title))
+ errors.add(:base, ts("^%{parent_title} is one of the ancestors of %{child_title}", :child_title => child_skin.title, :parent_title => parent_skin.title))
end
end
View
4 lib/tasks/after_tasks.rake
@@ -361,5 +361,5 @@ desc "Run all current migrate tasks"
#task :After => ['After:fix_default_pseuds', 'After:remove_owner_kudos']
#task :After => ['autocomplete:reload_data']
#task :After => ['After:set_complete_status', 'After:invite_external_authors']
-task :After => ['After:convert_tag_sets', 'skins:disable_all', 'skins:unapprove_all', 'skins:load_site_skins', 'After:convert_existing_skins',
- 'autocomplete:reload_tagset_data', 'skins:load_user_skins', 'After:remove_old_epubs']
+task :After => ['After:convert_tag_sets', 'autocomplete:reload_tagset_data', 'skins:disable_all', 'skins:unapprove_all', 'skins:load_site_skins', 'After:convert_existing_skins',
+ 'skins:load_user_skins', 'After:remove_old_epubs']
View
43 lib/tasks/skin_tasks.rake
@@ -5,11 +5,6 @@ namespace :skins do
STDIN.gets.chomp.strip
end
- desc "Load site skins"
- task(:load_site_skins => :environment) do
- Skin.load_site_css
- end
-
def replace_or_new(skin_content)
skin = Skin.new
if skin_content.match(/REPLACE:\s*(\d+)/)
@@ -56,10 +51,7 @@ namespace :skins do
end
end
- desc "Load user skins"
- task(:load_user_skins => :environment) do
- replace = ask("Replace existing skins with same titles? (y/n) ") == "y"
-
+ def get_user_skins
dir = Skin.site_skins_dir + 'user_skins_to_load'
default_preview_filename = "#{dir}/previews/default_preview.png"
user_skin_files = Dir.entries(dir).select {|f| f.match(/css$/)}
@@ -68,9 +60,28 @@ namespace :skins do
skins << File.read("#{dir}/#{skin_file}").split(/\/\*\s*END SKIN\s*\*\//)
end
skins.flatten!
+ end
+
+ desc "Purge user skins parents"
+ task(:purge_user_skins_parents => :environment) do
+ get_user_skins.each do |skin_content|
+ skin = replace_or_new(skin_content)
+ if skin.new_record? && skin_content.match(/SKIN:\s*(.*)\s*\*\//)
+ skin = Skin.find_by_title($1.strip)
+ end
+ skin.skin_parents.delete_all
+ end
+ end
+
+ desc "Load user skins"
+ task(:load_user_skins => :environment) do
+ replace = ask("Replace existing skins with same titles? (y/n) ") == "y"
+ Rake::Task['skins:purge_user_skins_parents'].invoke if replace
author = User.find_by_login("lim")
+ dir = Skin.site_skins_dir + 'user_skins_to_load'
+ skins = get_user_skins
skins.each do |skin_content|
next if skin_content.blank?
@@ -88,7 +99,6 @@ namespace :skins do
next
end
end
-
skin.title = title
preview_filename = "#{dir}/previews/#{title.gsub(/[^\w\s]+/, '')}.png"
unless File.exists?(preview_filename)
@@ -108,7 +118,7 @@ namespace :skins do
skin.author = author unless skin.author
if skin_content.match(/DESCRIPTION:\s*(.*?)\*\//m)
- skin.description = $1
+ skin.description = "<pre>#{$1}</pre>"
end
if skin_content.match(/PARENT_ONLY/)
skin.unusable = true
@@ -135,15 +145,20 @@ namespace :skins do
end
end
+
+ desc "Load site skins"
+ task(:load_site_skins => :environment) do
+ Skin.load_site_css
+ end
- desc "Disable all existing skins"
+ desc "Remove all existing skins from preferences"
task(:disable_all => :environment) do
default_id = Skin.default.id
Preference.update_all(:skin_id => default_id)
end
- desc "Unapprove all existing skins"
- task(:disable_all => :environment) do
+ desc "Unapprove all existing official skins"
+ task(:unapprove_all => :environment) do
default_id = Skin.default.id
Skin.where("id != ?", default_id).update_all(:official => false)
end
View
4 public/stylesheets/site/2.0/10-types-groups.css
@@ -36,7 +36,9 @@ dl.index{ margin:0.643em 0; border:none; box-shadow:none}
dl.index dt
{ width:auto; float:none; border:none;}
dl.index dd
- { width:auto; float:none; clear:right; margin:0 0.25em 0.643em 2.5em; padding:0.375em 0.15em 0; overflow:hidden; background: #e8e6ed}
+ { width:auto; float:none; clear:right; margin:0 0.25em 0.643em 2.5em; padding:0.375em 0.15em 0.15em; overflow:visible; background: #e8e6ed}
+dl.index dd :after
+ { content:" "; display:block; height:0; font-size:0; clear:both; visibility:hidden; }
dl.index dd p, dl.index dd .heading, dl.index ul
{ display:inline-block }
View
2  public/stylesheets/site/2.0/22-system-messages.css
@@ -64,5 +64,5 @@ dl#symbols-key dd
#symbols-key dl dt img, #bookmark-symbols-key dt img, #symbols-key dl dt, #bookmark-symbols-key dt
{ height: 25px; width: 25px }
#symbols-key dl dd, #bookmark-symbols-key dd
- { margin: -1.2525em auto auto 35px }
+ { margin: -25px auto 20px 35px }
/*END== */
View
6 public/stylesheets/site/user_skins_to_load/blurblings.css
@@ -206,3 +206,9 @@ li.relationships + li.freeforms:before {
/* END SKIN */
+/* SKIN: Plain Text */
+/* REPLACE: 2 */
+/* PARENTS: Blurblings Blurb Drop */
+* {font-family:serif !important;}
+/* END SKIN*/
+
View
2  public/stylesheets/site/user_skins_to_load/chainedmelody.css
@@ -128,4 +128,4 @@ body, .heading
/* SKIN: Chained Melody */
/* DESCRIPTION: Please DO copy and reuse and modify this code any way you like! Chaining all the components together to make a complete theme*/
/* PARENTS: Chained Buttons, Chained Head, Chained Groups, Chained Quotes, Chained Icons, Chained Key */
-/* END SKIN */
+/* END SKIN */
Please sign in to comment.
Something went wrong with that request. Please try again.