Skip to content

Commit

Permalink
Implement styles for new and edit via form partial for portfolios; im…
Browse files Browse the repository at this point in the history
…plement removal of jumbotron when admin logged in.
  • Loading branch information
solidstatejake committed Jun 19, 2019
1 parent 68c3f27 commit 65ebe6f
Show file tree
Hide file tree
Showing 4 changed files with 44 additions and 22 deletions.
2 changes: 1 addition & 1 deletion app/views/layouts/portfolio.html.erb
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@

<%= render 'shared/portfolio_nav' %>

<%= render 'shared/portfolio_jumbotron' %>
<%= render 'shared/portfolio_jumbotron' unless logged_in? :site_admin %>

<%= yield %>

Expand Down
52 changes: 33 additions & 19 deletions app/views/portfolios/_form.html.erb
Original file line number Diff line number Diff line change
@@ -1,31 +1,45 @@

<%= form_with(model: @portfolio_item, local: true) do |form| %>
<div class="row">
<div class="col-md-6">

<div class="field">
<%= form.label :title %>
<%= form.text_field :title %>
</div>
<div class="form-group">
<%= form.label :title %>
<%= form.text_field :title, class: 'form-control' %>
</div>

<div class="field">
<%= form.label :subtitle %>
<%= form.text_field :subtitle %>
</div>
<div class="form-group">
<%= form.label :subtitle %>
<%= form.text_field :subtitle, class: 'form-control' %>
</div>

</div>


<div class="col-md-6">

<div class="field">
<%= form.label :body %>
<%= form.text_area :body %>
<div class="form-group">
<%= form.label :body %>
<%= form.text_area :body, class: 'form-control' %>
</div>

</div>
</div>

<ul>

<h2>Technologies Used:</h2>
<%# if request.fullpath == new_portfolio_path %>

<div>
<%= form.fields_for :technologies do |tech_form| %>
<li>
<div class="form-group">
<%= tech_form.label :name %>
<%= tech_form.text_field :name %>
</li>
<%= tech_form.text_field :name, class: 'form-control' %>
</div>
<% end %>
</ul>
</div>


<div class="actions">
<%= form.submit %>
<div class="form-group">
<%= form.submit 'Create Portfolio Item', class: 'btn btn-primary' %>
</div>
<% end %>
8 changes: 6 additions & 2 deletions app/views/portfolios/edit.html.erb
Original file line number Diff line number Diff line change
@@ -1,3 +1,7 @@
<h1>Edit this Portfolio Item</h1>
<div class="container portfolio-form">

<%= render 'form', portfolio_item: @portfolio_item %>
<h1>Edit <%= @portfolio_item.title %> </h1>

<%= render 'form', portfolio_item: @portfolio_item %>

</div>
4 changes: 4 additions & 0 deletions app/views/portfolios/new.html.erb
Original file line number Diff line number Diff line change
@@ -1,4 +1,8 @@
<div class="container portfolio-form">

<h1>Create a New Portfolio Item</h1>

<%= render 'form', portfolio_item: @portfolio_item %>

</div>

0 comments on commit 65ebe6f

Please sign in to comment.