initial commit
This commit is contained in:
53
whatforlunch.com/app/views/layouts/application.html.erb
Normal file
53
whatforlunch.com/app/views/layouts/application.html.erb
Normal file
@@ -0,0 +1,53 @@
|
||||
<!DOCTYPE html>
|
||||
<html lang="bs_BA">
|
||||
<head>
|
||||
<meta charset="utf-8">
|
||||
<meta http-equiv="X-UA-Compatible" content="IE=edge">
|
||||
<meta name="viewport" content="width=device-width, initial-scale=1">
|
||||
<meta name="description" content="">
|
||||
<meta name="author" content="">
|
||||
|
||||
<title>Theme Template for Bootstrap</title>
|
||||
<!--[if lt IE 9]>
|
||||
<script src="http://html5shim.googlecode.com/svn/trunk/html5.js" type="text/javascript"></script>
|
||||
<![endif]-->
|
||||
<%= stylesheet_link_tag "application", media: "all" %>
|
||||
<%= javascript_include_tag "application" %>
|
||||
<%= csrf_meta_tags %>
|
||||
</head>
|
||||
|
||||
<body role="document">
|
||||
|
||||
<!-- Fixed navbar -->
|
||||
<div class="navbar navbar-inverse navbar-fixed-top" role="navigation">
|
||||
<div class="container">
|
||||
<div class="navbar-header">
|
||||
<button type="button" class="navbar-toggle" data-toggle="collapse" data-target=".navbar-collapse">
|
||||
<span class="sr-only">Toggle navigation</span>
|
||||
<span class="icon-bar"></span>
|
||||
<span class="icon-bar"></span>
|
||||
<span class="icon-bar"></span>
|
||||
</button>
|
||||
<a class="navbar-brand" target="_blank" href="http://www.coolinarika.com">Šta za ručak?</a>
|
||||
</div>
|
||||
<div class="navbar-collapse collapse">
|
||||
<ul class="nav navbar-nav">
|
||||
<li class="dropdown">
|
||||
<a href="#" class="dropdown-toggle" data-toggle="dropdown">Recepti<b class="caret"></b></a>
|
||||
<ul class="dropdown-menu">
|
||||
<li><a href="<%= recipes_path %>">Lista</a></li>
|
||||
<li><a href="<%= new_recipe_path %>">Novi recept</a></li>
|
||||
|
||||
</ul>
|
||||
</li>
|
||||
</ul>
|
||||
</div><!--/.nav-collapse -->
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="container" role="main">
|
||||
<%= yield %>
|
||||
</div> <!-- /container -->
|
||||
|
||||
</body>
|
||||
</html>
|
||||
41
whatforlunch.com/app/views/recipes/_form.html.erb
Normal file
41
whatforlunch.com/app/views/recipes/_form.html.erb
Normal file
@@ -0,0 +1,41 @@
|
||||
<%= form_for(@recipe) do |f| %>
|
||||
<% if @recipe.errors.any? %>
|
||||
<div id="error_explanation">
|
||||
<h2><%= pluralize(@recipe.errors.count, "error") %> prohibited this recipe from being saved:</h2>
|
||||
|
||||
<ul>
|
||||
<% @recipe.errors.full_messages.each do |msg| %>
|
||||
<li><%= msg %></li>
|
||||
<% end %>
|
||||
</ul>
|
||||
</div>
|
||||
<% end %>
|
||||
|
||||
<div class="field">
|
||||
<%= f.label :name %><br>
|
||||
<%= f.text_field :name %>
|
||||
</div>
|
||||
<div class="field">
|
||||
<%= f.label :duration %><br>
|
||||
<%= f.text_field :duration %>
|
||||
</div>
|
||||
<div class="field">
|
||||
<%= f.label :ingredients %><br>
|
||||
<%= f.text_field :ingredients %>
|
||||
</div>
|
||||
<div class="field">
|
||||
<%= f.label :process %><br>
|
||||
<%= f.text_field :process %>
|
||||
</div>
|
||||
<div class="field">
|
||||
<%= f.label :picture_url %><br>
|
||||
<%= f.text_field :picture_url %>
|
||||
</div>
|
||||
<div class="field">
|
||||
<%= f.label :original_url %><br>
|
||||
<%= f.text_field :original_url %>
|
||||
</div>
|
||||
<div class="actions">
|
||||
<%= f.submit %>
|
||||
</div>
|
||||
<% end %>
|
||||
98
whatforlunch.com/app/views/recipes/edit.html.erb
Normal file
98
whatforlunch.com/app/views/recipes/edit.html.erb
Normal file
@@ -0,0 +1,98 @@
|
||||
<h1>Promjena recepta</h1>
|
||||
|
||||
<%= form_for(@recipe, html: {role: "form"}) do |f| %>
|
||||
|
||||
<div class="form_group row">
|
||||
<%= f.label :name, class: "col-md-1 control-label" %>
|
||||
<div class="col-md-4">
|
||||
<%= f.text_field :name, class: "form-control" %>
|
||||
</div>
|
||||
<% if @recipe.name.to_s.length > 14 %>
|
||||
<div id="name" class="col-md-4 danger" >
|
||||
|
||||
Ime je predugo - skrati do 14 slova!
|
||||
|
||||
</div>
|
||||
<% end %>
|
||||
</div>
|
||||
<div class="form_group row">
|
||||
<%= f.label :duration, class: "col-md-1 control-label" %>
|
||||
<div class="col-md-4">
|
||||
<%= f.text_field :duration, class: "form-control" %>
|
||||
</div>
|
||||
<% if @recipe.duration.to_s.length > 10 %>
|
||||
<div id="duration" class="col-md-4 danger">
|
||||
|
||||
Dužina je prevelika - skrati do 10 slova!
|
||||
|
||||
</div>
|
||||
<% end %>
|
||||
</div>
|
||||
|
||||
<div class="form_group row">
|
||||
<%= f.label :ingredients, class: "col-md-1 control-label" %>
|
||||
<div class="col-md-4">
|
||||
<%= f.text_area :ingredients, class: "form-control", rows: "10" %>
|
||||
</div>
|
||||
<% unless @recipe.ingredients_fit? %>
|
||||
<div id="ingredients" class="col-md-4 danger">
|
||||
Ne smije biti više od 20 sastojaka i svaki sastojak ne smije imati više od 22 znaka (slova, broja, praznine itd.).
|
||||
Skrati ili izbaci neke sastojke.
|
||||
</div>
|
||||
<% end %>
|
||||
</div>
|
||||
|
||||
|
||||
<div class="form_group row">
|
||||
<%= f.label :process, class: "col-md-1 control-label" %>
|
||||
<div class="col-md-4">
|
||||
<%= f.text_area :process , class: "form-control" , rows: "15" %>
|
||||
|
||||
</div>
|
||||
<% unless @recipe.process_fits? %>
|
||||
<div id="process" class="col-md-4 danger">
|
||||
Priprema mora imati najvise 15 redova a ni jedan red ne smije biti duzi od 44 slova.
|
||||
Skrati malo.
|
||||
</div>
|
||||
<% end %>
|
||||
|
||||
</div>
|
||||
|
||||
<div class="form_group row ">
|
||||
<div class="col-md-1">
|
||||
Slika
|
||||
</div>
|
||||
<div class="col-md-4">
|
||||
<%= link_to(@recipe.picture_url, class: "thumbnail") do %>
|
||||
<%= image_tag(@recipe.picture_url) %>
|
||||
<% end %>
|
||||
<%= link_to(" Nađi drugu sliku", @recipe.search_url, target: "_blank" ) %>
|
||||
</div>
|
||||
|
||||
|
||||
|
||||
</div>
|
||||
|
||||
<div class="form_group row">
|
||||
|
||||
<%= f.label :picture_url, class: "col-md-1 control-label" %>
|
||||
<div class="col-md-4">
|
||||
<%= f.text_field :picture_url, class: "form-control" %>
|
||||
</div>
|
||||
<% unless @recipe.picture_ok? %>
|
||||
<div id="picture" class="col-md-4 danger">
|
||||
Slika mora biti izabrana!
|
||||
Slika ne smije biti sa stranice coolinarika. Nadji drugu.
|
||||
</div>
|
||||
<% end %>
|
||||
|
||||
</div>
|
||||
|
||||
|
||||
<div class="form_group row">
|
||||
<%= f.submit class: "btn btn-success" %>
|
||||
</div>
|
||||
|
||||
<% end %>
|
||||
|
||||
|
||||
34
whatforlunch.com/app/views/recipes/index.html.erb
Normal file
34
whatforlunch.com/app/views/recipes/index.html.erb
Normal file
@@ -0,0 +1,34 @@
|
||||
<div class="row">
|
||||
|
||||
<div class="col-md-8">
|
||||
|
||||
<h1>Recepti</h1>
|
||||
|
||||
<table class="table">
|
||||
<thead>
|
||||
<tr>
|
||||
<th>Ime</th>
|
||||
<th>Datum</th>
|
||||
<th>Ispravan?</th>
|
||||
<th></th>
|
||||
</tr>
|
||||
</thead>
|
||||
|
||||
<tbody>
|
||||
<% @recipes.each do |recipe| %>
|
||||
<tr>
|
||||
<td><%= recipe.name %></td>
|
||||
<td><%= recipe.ordinal_date %></td>
|
||||
<td><%= (recipe.is_it_valid?) ? "DA" : "NE" %></td>
|
||||
<td><%= link_to 'Popravi recept', edit_recipe_path(recipe) %></td>
|
||||
|
||||
</tr>
|
||||
<% end %>
|
||||
</tbody>
|
||||
</table>
|
||||
|
||||
<br>
|
||||
|
||||
<%= link_to 'Napravi novi recept', new_recipe_path %>
|
||||
</div>
|
||||
</div>
|
||||
4
whatforlunch.com/app/views/recipes/index.json.jbuilder
Normal file
4
whatforlunch.com/app/views/recipes/index.json.jbuilder
Normal file
@@ -0,0 +1,4 @@
|
||||
json.array!(@recipes) do |recipe|
|
||||
json.extract! recipe, :id, :name, :duration, :ingredients, :process, :picture_url, :original_url
|
||||
json.url recipe_url(recipe, format: :json)
|
||||
end
|
||||
16
whatforlunch.com/app/views/recipes/new.html.erb
Normal file
16
whatforlunch.com/app/views/recipes/new.html.erb
Normal file
@@ -0,0 +1,16 @@
|
||||
<h1>Pravljenje Novog Recepta</h1>
|
||||
|
||||
<%= form_for(@recipe, html: {role: "form"}) do |f| %>
|
||||
|
||||
<div class="form_group row">
|
||||
|
||||
<%= f.label :original_url, class: "col-md-1 control-label" %>
|
||||
<div class="col-md-6">
|
||||
<%= f.url_field :original_url, class: "form-control" %>
|
||||
</div>
|
||||
<div class="col-md-1">
|
||||
<%= f.submit class: "btn btn-success" %>
|
||||
</div>
|
||||
</div>
|
||||
<% end %>
|
||||
|
||||
34
whatforlunch.com/app/views/recipes/show.html.erb
Normal file
34
whatforlunch.com/app/views/recipes/show.html.erb
Normal file
@@ -0,0 +1,34 @@
|
||||
<p id="notice"><%= notice %></p>
|
||||
|
||||
<p>
|
||||
<strong>Name:</strong>
|
||||
<%= @recipe.name %>
|
||||
</p>
|
||||
|
||||
<p>
|
||||
<strong>Duration:</strong>
|
||||
<%= @recipe.duration %>
|
||||
</p>
|
||||
|
||||
<p>
|
||||
<strong>Ingredients:</strong>
|
||||
<%= @recipe.ingredients %>
|
||||
</p>
|
||||
|
||||
<p>
|
||||
<strong>Process:</strong>
|
||||
<%= @recipe.process %>
|
||||
</p>
|
||||
|
||||
<p>
|
||||
<strong>Picture url:</strong>
|
||||
<%= @recipe.picture_url %>
|
||||
</p>
|
||||
|
||||
<p>
|
||||
<strong>Original url:</strong>
|
||||
<%= @recipe.original_url %>
|
||||
</p>
|
||||
|
||||
<%= link_to 'Edit', edit_recipe_path(@recipe) %> |
|
||||
<%= link_to 'Back', recipes_path %>
|
||||
1
whatforlunch.com/app/views/recipes/show.json.jbuilder
Normal file
1
whatforlunch.com/app/views/recipes/show.json.jbuilder
Normal file
@@ -0,0 +1 @@
|
||||
json.extract! @recipe, :id, :name, :duration, :ingredients, :process, :picture_url, :original_url, :created_at, :updated_at
|
||||
Reference in New Issue
Block a user