news posts read from the database, with a campaign-supplement classname option :)

This commit is contained in:
Matchu 2015-09-26 20:37:03 -07:00
parent 49cd93087a
commit b5442d0f3f
10 changed files with 53 additions and 5 deletions

View file

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

View file

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

View file

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

View file

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

View file

@ -79,6 +79,8 @@ class OutfitsController < ApplicationController
@neopets_usernames = user_signed_in? ? current_user.neopets_usernames : []
@campaign = Campaign.current rescue nil
@news_posts = NewsPost.all
end
def show

3
app/models/news_post.rb Normal file
View file

@ -0,0 +1,3 @@
class NewsPost < ActiveRecord::Base
attr_accessible :body, :html_class
end

View file

@ -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'

View file

@ -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 file

@ -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 @@ ActiveRecord::Schema.define(:version => 20150923052017) do
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"

View file

@ -0,0 +1,5 @@
require 'spec_helper'
describe NewsPost do
pending "add some examples to (or delete) #{__FILE__}"
end