Permalink
Browse files

More shit

  • Loading branch information...
1 parent 88883b3 commit b0c2ae205d56e84d8be898f8ef2f983eeb5d0e78 @brettware committed Feb 17, 2017
@@ -1,4 +1,4 @@
-$navbar-default-bg: #f46542;
+$navbar-default-bg: #232121;
@import "bootstrap-sprockets";
@import "bootstrap";
@@ -16,7 +16,7 @@ def edit
def create
@article = Article.new(article_params)
if @article.save
- flash[:notice] = "Article was succesfully created"
+ flash[:success] = "Article was succesfully created"
redirect_to article_path(@article)
else
render 'new'
@@ -25,7 +25,7 @@ def create
def update
if @article.update(article_params)
- flash[:notice] = "Article was succesfully updated"
+ flash[:success] = "Article was succesfully updated"
redirect_to article_path(@article)
else
render 'edit'
@@ -38,7 +38,7 @@ def show
def destroy
@article.destroy
- flash[:notice] = "Article was succesfully deleted"
+ flash[:danger] = "Article was succesfully deleted"
redirect_to articles_path
end
@@ -1,24 +1,34 @@
-<% if @article.errors.any? %>
-<h2>The following errors prevent this article from being created</h2>
-<ul>
- <% @article.errors.full_messages.each do |msg| %>
- <li><%= msg %></li>
- <% end %>
-</ul>
-<% end %>
+<%= render 'shared/errors', obj: @article %>
-<%= form_for @article do |f| %>
- <%= f.label :title %><br/>
- <%= f.text_field :title %>
- </p>
- <p>
- <%= f.label :description %><br/>
- <%= f.text_area :description %>
- </p>
+<div class='row'>
+ <div class='col-xs-12'>
+ <%= form_for(@article, :html => {class: "form-horizontal", role: "form"}) do |f| %>
+ <div class="form-group">
+ <div class="control-label col-sm-2">
+ <%= f.label :title %>
+ </div>
+ <div class="col-sm-8">
+
+ <%= f.text_field :title, class: "form-control", placeholder: "Title of article", autofocus: true %>
+ </div>
+ </div>
+ <div class="form-group">
+ <div class="control-label col-sm-2">
+ <%= f.label :description %>
+ </div>
+ <div class="col-sm-8">
+ <%= f.text_area :description, class: "form-control", placeholder: "Body of article" %>
+ </div>
+ </div>
- <p>
- <%= f.submit %>
- </p>
-<% end %>
-
-<%= link_to "Back to articles listing", articles_path %>
+ <div class="form-group">
+ <div class="col-sm-offset-2 col-sm-10">
+ <%= f.submit class: 'btn btn-primary btn-lg' %>
+ </div>
+ </div>
+ <% end %>
+ <div class="col xs-4 col xs-offset-4">
+ [ <%= link_to "Cancel request and return to articles listing", articles_path %> ]
+ </div>
+ </div>
+</div>
@@ -1,12 +1,13 @@
-<h1>Showing selected article</h1>
+<h2 align="center"> Title: <%= @article.title %></h2>
+<div class="well col-xs-8 col-xs-offset-2">
+ <h4 class="center"><strong>Descriptions</strong></h4>
+ <hr>
+ <%= simple_format(@article.description) %>
+ <div class="article-actions">
-<p>
- Title: <%= @article.title %>
-</p>
-<p>
- Description: <%= @article.description %>
-</p>
-
-<%= link_to "Edit this article bro", edit_article_path(@article) %> |
-<%= link_to "Back to articles listing", articles_path %>
+ <%= link_to "Edit this article bro", edit_article_path(@article), class: "btn btn-xs btn-primary" %>
+ <%= link_to "Delete this article, broski", article_path(@article), method: :delete,
+ data: { confirm: "You sure, broseph?"},
+ class: "btn btn-xs btn-danger" %>
+ <%= link_to "Broseph, view all articles", articles_path, class: "btn btn-xs btn-success" %>
@@ -1,5 +1,11 @@
-<% flash.each do |name, msg| %>
- <ul>
- <li><%= msg %></li>
- </ul>
- <% end %>
+<div class="row">
+ <div class="col-xs-10 col-xs-offset-1">
+ <% flash.each do |name, msg| %>
+ <div class='alert alert=<%="#{name}" %>'>
+ <a href="#" class="close" data-dismiss="alert">&#215;</a>
+ <%= content_tag :div, msg, :id => "flash_#{name}" if msg.is_a?(String) %>
+ </div>
+ <% end %>
+ </div>
+</div>
+
@@ -0,0 +1,21 @@
+<% if obj.errors.any? %>
+ <div class="row">
+ <div class="col-xs-8 col-xs-offset-2">
+ <div class="panel panel-danger">
+ <div class ="panel-heading">
+ <h2 class="panel-title">
+ <%= pluralize(obj.errors.count, "error") %>
+ prohibited this article from being displayed
+ </h2>
+ <div class="panel-body">
+ <ul>
+ <% obj.errors.full_messages.each do |msg| %>
+ <li><%= msg %></li>
+ <% end %>
+ </ul>
+ </div>
+ </div>
+ </div>
+ </div>
+ </div>
+<% end %>

0 comments on commit b0c2ae2

Please sign in to comment.