Skip to content

Commit

Permalink
normalize UI Add Entities list #66 and form (temp fix) for #67
Browse files Browse the repository at this point in the history
  • Loading branch information
bnvk committed Jul 2, 2019
1 parent 0853e7d commit f8130c1
Show file tree
Hide file tree
Showing 2 changed files with 96 additions and 106 deletions.
146 changes: 68 additions & 78 deletions app/views/entities/create.html.erb
Original file line number Diff line number Diff line change
@@ -1,84 +1,74 @@
<div id="sidebar" class="col-sm-4 col-md-3 sidebar">
<div class="detail-heading">
Filter Categories
</div>
<% category_fields = @entity["source_fields"].select{|k,v| v["display_type"] != "None" && v["display_type"] == "Category"} %>
<% category_fields.each do |name, field| %>
<p>
<%= field["human_readable"] %>
</p>
<% end %>
</div>
<div id="maincontent" class="efm-target col-sm-8 col-sm-offset-4 col-md-9 col-md-offset-3 main">
<ul class="nav nav-pills" style="text-align:center;">
<li>
<a href="/entities">
<i class="icon-list"></i>
Add Entities
</a>
</li>
<li class="active">
<a href="/entities_create/<%= @entity["class_name"] %>">
<i class="<%= @entity["icon"] %>"></i>
Create <%= @entity["name"] %>
</a>
</li>
</ul>
<div class="tab-content">
<h3><%= @entity["name"] %></h3>
<form name="edited" method="post"
action="<%=ENV['RAILS_RELATIVE_URL_ROOT']%>entities/save">
<div id="fields-<%= @entity["class_name"] %>">
<% entity_fields = @entity["source_fields"].select{|k,v| v["display_type"] != "None" && v["display_type"] != "Category"} %>
<% entity_fields.each do |name, field| %>
<p class="<%= name %>">
<strong class="label">
<%= field["human_readable"] %>
</strong>
</p>
<% if field["display_type"] == "Title" or field["display_type"] == "Description" %>
<input type="text" name="edited[items[<%= field["human_readable"].downcase %>]]" class="form-control add-bottom" value="">
<% elsif field["display_type"] == "Short Text" %>
<textarea name="edited[items[<%= field["human_readable"].downcase %>]]" class="form-control add-bottom" rows="3"></textarea>
<% elsif field["display_type"] == "Long Text" %>
<textarea name="edited[items[<%= field["human_readable"].downcase %>]]" class="form-control add-bottom" rows="8"></textarea>
<% elsif field["display_type"] =="Date" %>
<div class="form-group">
<div class="input-group date" id="datetimepicker-<%= field["human_readable"] %>">
<input type="text" name="edited[items[<%= field["human_readable"].downcase %>]]" class="form-control" value="">
<span class="input-group-addon">
<span class="icon-calendar"></span> Choose Date
</span>
<div class="container">
<div id="maincontent" class="col-sm-8 col-sm-offset-2 col-md-8 col-md-offset-2 main">
<ul class="nav nav-pills" style="text-align:center;">
<li>
<a href="/entities">
<i class="icon-list"></i>
Add Entities
</a>
</li>
<li class="active">
<a href="/entities_create/<%= @entity["class_name"] %>">
<i class="<%= @entity["icon"] %>"></i>
Create <%= @entity["name"] %>
</a>
</li>
</ul>
<div class="tab-content">
<h3><%= @entity["name"] %></h3>
<form name="edited" method="post"
action="<%=ENV['RAILS_RELATIVE_URL_ROOT']%>entities/save">
<div id="fields-<%= @entity["class_name"] %>">
<% entity_fields = @entity["source_fields"].select{|k,v| v["display_type"] != "None" && v["display_type"] != "Category"} %>
<% entity_fields.each do |name, field| %>
<p class="<%= name %>">
<strong class="label">
<%= field["human_readable"] %>
</strong>
</p>
<% if field["display_type"] == "Title" or field["display_type"] == "Description" %>
<input type="text" name="edited[items[<%= field["human_readable"].downcase %>]]" class="form-control add-bottom" value="">
<% elsif field["display_type"] == "Short Text" %>
<textarea name="edited[items[<%= field["human_readable"].downcase %>]]" class="form-control add-bottom" rows="3"></textarea>
<% elsif field["display_type"] == "Long Text" %>
<textarea name="edited[items[<%= field["human_readable"].downcase %>]]" class="form-control add-bottom" rows="8"></textarea>
<% elsif field["display_type"] =="Date" %>
<div class="form-group">
<div class="input-group date" id="datetimepicker-<%= field["human_readable"] %>">
<input type="text" name="edited[items[<%= field["human_readable"].downcase %>]]" class="form-control" value="">
<span class="input-group-addon">
<span class="icon-calendar"></span> Choose Date
</span>
</div>
</div>
</div>
<script>
var runEntityJS = function() {
$('#datetimepicker-<%= field["human_readable"] %>').datetimepicker({
format: 'YYYY-MM-DD',
icons: datetimepicker_icons
})
}
</script>
<% elsif field["display_type"] == "Related Link" %>
<input type="text" name="edited[items[<%= field["human_readable"].downcase %>]]" class="url-validate form-control" value="">
<script>
var runEntityJS = function() {
$('#datetimepicker-<%= field["human_readable"] %>').datetimepicker({
format: 'YYYY-MM-DD',
icons: datetimepicker_icons
})
}
</script>
<% elsif field["display_type"] == "Related Link" %>
<input type="text" name="edited[items[<%= field["human_readable"].downcase %>]]" class="url-validate form-control" value="">
<% end %>
<% end %>
<% end %>
</div>
<input type="hidden" id="doc_id" name="edited[doc_id]" value="/entities/create">
<input type="hidden" id="class_name" name="edited[doc_type]" value="<%= @entity["class_name"] %>">
<div class="row">
<div class="col-xs-6 col-sm-6 col-md-6 title">
</div>
<div class="col-xs-6 col-sm-6 col-md-6 text-right">
<button type="submit" class="pull-right btn btn-primary btn-sm" id="button-editable-action">
Save <%= @entity["name"] %>
</button>
<a href="/entities" class="pull-right btn btn-sm btn-info add-right">
Cancel
</a>
<input type="hidden" id="doc_id" name="edited[doc_id]" value="/entities/create">
<input type="hidden" id="class_name" name="edited[doc_type]" value="<%= @entity["class_name"] %>">
<div class="row">
<div class="col-xs-6 col-sm-6 col-md-6 title">
</div>
<div class="col-xs-6 col-sm-6 col-md-6 text-right">
<button type="submit" class="pull-right btn btn-primary btn-sm" id="button-editable-action">
Save <%= @entity["name"] %>
</button>
<a href="/entities" class="pull-right btn btn-sm btn-info add-right">
Cancel
</a>
</div>
</div>
</div>
</form>
</form>
</div>
</div>
</div>
<%= render partial: 'shared/modals_editor' %>
56 changes: 28 additions & 28 deletions app/views/entities/index.html.erb
Original file line number Diff line number Diff line change
@@ -1,32 +1,32 @@
<div class="container">
<div id="maincontent" class="col-sm-12 col-md-12 col-lg-12 main">
<ul class="nav nav-pills" style="text-align:center;">
<li class="active">
<a href="<%= ENV['RAILS_RELATIVE_URL_ROOT'] %>catalyst/">
<i class="icon-list"></i>
Add Entities
</a>
</li>
</ul>
<div class="tab-content">
<% @entity_specs.each_with_index do |entity, index| %>
<div id="entity-<%= entity["class_name"] %>" class="row">
<div class="col-md-10">
<h3>
<%= entity["name"] %>
</h3>
<%= entity["description"] %>
<div id="maincontent" class="col-sm-8 col-sm-offset-2 col-md-8 col-md-offset-2 main">
<ul class="nav nav-pills" style="text-align:center;">
<li class="active">
<a href="<%= ENV['RAILS_RELATIVE_URL_ROOT'] %>catalyst/">
<i class="icon-list"></i>
Add Entities
</a>
</li>
</ul>
<div class="tab-content">
<% @entity_specs.each_with_index do |entity, index| %>
<div id="entity-<%= entity["class_name"] %>" class="row">
<div class="col-md-9">
<h3>
<%= entity["name"] %>
</h3>
<%= entity["description"] %>
</div>
<div class="col-md-3">
<a href="<%= ENV['RAILS_RELATIVE_URL_ROOT'] %>entities_create/<%= entity["class_name"] %>" class="btn btn-primary btn-block">
<i class="<%= entity["icon"] %>"></i>&nbsp;
Add <%= entity["name"] %>
</a>
</div>
<input type="hidden" id="class_name" value="<%= entity["class_name"] %>">
</div>
<div class="col-md-2">
<a href="<%= ENV['RAILS_RELATIVE_URL_ROOT'] %>entities_create/<%= entity["class_name"] %>" class="btn btn-primary btn-block">
<i class="<%= entity["icon"] %>"></i>&nbsp;
Add <%= entity["name"] %>
</a>
</div>
<input type="hidden" id="class_name" value="<%= entity["class_name"] %>">
</div>
<hr>
<% end %>
<hr>
<% end %>
</div>
</div>
</div>
</div>

0 comments on commit f8130c1

Please sign in to comment.