Permalink
Browse files

news posts read from the database, with a campaign-supplement classna…

…me option :)
  • Loading branch information...
1 parent 49cd930 commit b5442d0f3f1efee5e0127bd17b00ee7bfc99401c @matchu matchu committed Sep 27, 2015
@@ -119,11 +119,14 @@ ul.buttons
#locale-form
float: right
-.success, .alert, .warning
+=flash
margin-bottom: 1em
padding: .25em .5em
text-align: center
+.success, .alert, .warning
+ +flash
+
.success
+notice
@@ -12,10 +12,10 @@ $outfit-banner-inner-width: $outfit-inner-width - (2 * $outfit-banner-h-padding)
body.campaigns-show, body.campaigns-current
+campaign-progress
- color: #004
+ color: $campaign-text-color
a
- color: #004 + #222
+ color: $campaign-text-color + #222
#userbar, #footer
color: $text-color
@@ -73,7 +73,7 @@ body.campaigns-show, body.campaigns-current
input[type=text]
border-color: #cce
- color: #004
+ color: $campaign-text-color
width: 3em
button
@@ -3,6 +3,19 @@
body.outfits-new
+campaign-progress
+ .news-post
+ p:last-child
+ margin-bottom: 0
+
+ &.campaign-supplement
+ +flash
+ background: $campaign-background-color
+ border: 1px solid $campaign-border-color
+ color: $campaign-text-color
+
+ a
+ color: $campaign-link-color
+
#pet-not-found, #neopia-error
display: none
@@ -1,5 +1,7 @@
$campaign-border-color: #006
$campaign-background-color: #eef
+$campaign-text-color: #004
+$campaign-link-color: $campaign-text-color + #222
=campaign-progress
.campaign-progress-wrapper
@@ -79,6 +79,8 @@ def new
@neopets_usernames = user_signed_in? ? current_user.neopets_usernames : []
@campaign = Campaign.current rescue nil
+
+ @news_posts = NewsPost.all
end
def show
@@ -0,0 +1,3 @@
+class NewsPost < ActiveRecord::Base
+ attr_accessible :body, :html_class
+end
@@ -2,6 +2,9 @@
= advertise_campaign_progress @campaign
+- @news_posts.each do |news_post|
+ .news-post{class: news_post.html_class}= md news_post.body
+
%p#pet-not-found.alert= t 'pets.load.not_found'
%p#neopia-error.alert= t 'pets.load.neopia_error'
@@ -0,0 +1,10 @@
+class CreateNewsPosts < ActiveRecord::Migration
+ def change
+ create_table :news_posts do |t|
+ t.text :body
+ t.string :html_class, default: 'success'
+
+ t.timestamps
+ end
+ end
+end
View
@@ -11,7 +11,7 @@
#
# It's strongly recommended to check this file into your version control system.
-ActiveRecord::Schema.define(:version => 20150923052017) do
+ActiveRecord::Schema.define(:version => 20150927033046) do
create_table "auth_servers", :force => true do |t|
t.string "short_name", :limit => 10, :null => false
@@ -200,6 +200,13 @@
t.datetime "updated_at", :null => false
end
+ create_table "news_posts", :force => true do |t|
+ t.text "body"
+ t.string "html_class", :default => "success"
+ t.datetime "created_at", :null => false
+ t.datetime "updated_at", :null => false
+ end
+
create_table "outfit_features", :force => true do |t|
t.integer "donation_id"
t.integer "outfit_id"
@@ -0,0 +1,5 @@
+require 'spec_helper'
+
+describe NewsPost do
+ pending "add some examples to (or delete) #{__FILE__}"
+end

0 comments on commit b5442d0

Please sign in to comment.