Refine the location module, but it have some bugs about path ...
This commit is contained in:
parent
11fefa100f
commit
dbfc70e520
2
vendor/built_in_modules/gprs/app/assets/javascripts/panel/gprs/back_end/locations.js
vendored
Normal file
2
vendor/built_in_modules/gprs/app/assets/javascripts/panel/gprs/back_end/locations.js
vendored
Normal file
|
@ -0,0 +1,2 @@
|
|||
// Place all the behaviors and hooks related to the matching controller here.
|
||||
// All this logic will automatically be available in application.js.
|
4
vendor/built_in_modules/gprs/app/assets/stylesheets/panel/gprs/back_end/locations.css
vendored
Normal file
4
vendor/built_in_modules/gprs/app/assets/stylesheets/panel/gprs/back_end/locations.css
vendored
Normal file
|
@ -0,0 +1,4 @@
|
|||
/*
|
||||
Place all the styles related to the matching controller here.
|
||||
They will automatically be included in application.css.
|
||||
*/
|
2
vendor/built_in_modules/gprs/app/helpers/panel/gprs/back_end/locations_helper.rb
vendored
Normal file
2
vendor/built_in_modules/gprs/app/helpers/panel/gprs/back_end/locations_helper.rb
vendored
Normal file
|
@ -0,0 +1,2 @@
|
|||
module Panel::Gprs::BackEnd::LocationsHelper
|
||||
end
|
|
@ -8,5 +8,4 @@ class Location
|
|||
field :description
|
||||
field :longitude, type: Float
|
||||
field :latitude, type: Float
|
||||
|
||||
end
|
34
vendor/built_in_modules/gprs/app/views/panel/gprs/back_end/locations/_form.html.erb
vendored
Normal file
34
vendor/built_in_modules/gprs/app/views/panel/gprs/back_end/locations/_form.html.erb
vendored
Normal file
|
@ -0,0 +1,34 @@
|
|||
<%= form_for @location, :url => 'panel_gprs_back_end_locations_path' ,:class=>"form-horizontal" do |f| %>
|
||||
<div class="control-group">
|
||||
<label class="control-label" for="">Name</label>
|
||||
<div class="controls">
|
||||
<%= f.text_field :name, :class=>"span4", :placeholder => "Area" %>
|
||||
</div>
|
||||
</div>
|
||||
<div class="control-group">
|
||||
<label class="control-label" for="">Picture</label>
|
||||
<div class="controls">
|
||||
<%= f.file_field :file %>
|
||||
</div>
|
||||
</div>
|
||||
<div class="control-group">
|
||||
<label class="control-label" for="">Coordinates</label>
|
||||
<div class="controls">
|
||||
<%= f.text_field :longitude, :class=>"span2", :placeholder => "Longitude" %>
|
||||
<%= f.text_field :latitude, :class=>"span2", :placeholder => "Langitude" %>
|
||||
</div>
|
||||
</div>
|
||||
<div class="control-group">
|
||||
<label class="control-label" for="">Description</label>
|
||||
<div class="controls">
|
||||
<%= f.text_area :description, :class=>"span4", :cols=>"30", :row=>"5" %>
|
||||
</div>
|
||||
</div>
|
||||
<div class="control-group">
|
||||
<div class="controls">
|
||||
<%= f.submit "Save", :class=>"btn" %>
|
||||
</div>
|
||||
</div>
|
||||
<% end %>
|
||||
<!-- </form> -->
|
||||
|
2
vendor/built_in_modules/gprs/app/views/panel/gprs/back_end/locations/edit.html.erb
vendored
Normal file
2
vendor/built_in_modules/gprs/app/views/panel/gprs/back_end/locations/edit.html.erb
vendored
Normal file
|
@ -0,0 +1,2 @@
|
|||
<%= render 'form' %>
|
||||
|
|
@ -1,42 +1,28 @@
|
|||
|
||||
<!-- <form class="form-horizontal"> -->
|
||||
<%= form_for @newlocation, :url=>{:action => "create"}, :remote => true, :class=>"form-horizontal" do |f| %>
|
||||
<div class="control-group">
|
||||
<label class="control-label" for="">Name</label>
|
||||
<div class="controls">
|
||||
<!-- <input type="text" id="" class="span4" placeholder="Taipei 101"> -->
|
||||
<%= f.text_field :name, :class=>"span4", :placeholder => "Area" %>
|
||||
</div>
|
||||
</div>
|
||||
<div class="control-group">
|
||||
<label class="control-label" for="">Picture</label>
|
||||
<div class="controls">
|
||||
<!-- <input type="file" id=""> -->
|
||||
<%= f.file_field :file %>
|
||||
</div>
|
||||
</div>
|
||||
<div class="control-group">
|
||||
<label class="control-label" for="">Coordinates</label>
|
||||
<div class="controls">
|
||||
<!-- <input type="text" id="" class="span2" placeholder="long"> -->
|
||||
<%= f.text_field :longitude, :class=>"span2", :placeholder => "Longitude" %>
|
||||
<%= f.text_field :latitude, :class=>"span2", :placeholder => "Langitude" %>
|
||||
|
||||
<!-- <input type="text" id="" class="span2" placeholder="lat"> -->
|
||||
</div>
|
||||
</div>
|
||||
<div class="control-group">
|
||||
<label class="control-label" for="">Description</label>
|
||||
<div class="controls">
|
||||
<!-- <textarea name="" id="" class="span4" cols="30" rows="5"></textarea> -->
|
||||
<%= f.text_area :description, :class=>"span4", :cols=>"30", :row=>"5" %>
|
||||
</div>
|
||||
</div>
|
||||
<div class="control-group">
|
||||
<div class="controls">
|
||||
<!-- <textarea name="" id="" class="span4" cols="30" rows="5"></textarea> -->
|
||||
<%= f.submit "Save", :class=>"btn" %>
|
||||
</div>
|
||||
</div>
|
||||
<table class="table main-list">
|
||||
<thead>
|
||||
<tr>
|
||||
<th class="span1"><%= t('location.picture') %></th>
|
||||
<th class="span1"><%= t('location.name') %></th>
|
||||
<th class="span1"><%= t('location.longitude') %></th>
|
||||
<th class="span1"><%= t('location.latitude') %></th>
|
||||
<th class="span3"><%= t('location.description') %></th>
|
||||
<th class="span1"><%= t('location.edit') %></th>
|
||||
<th class="span1"><%= t('location.delete') %></th>
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody id="tbody_locations" class="sort-holder">
|
||||
<% @locations.each do |location| %>
|
||||
<tr class="with_action">
|
||||
<td><%= image_tag(location.file, alt: location.file, size: "50x50" )%></td>
|
||||
<td><%= location.name%></td>
|
||||
<td><%= location.longitude%></td>
|
||||
<td><%= location.latitude%></td>
|
||||
<td><%= location.description%></td>
|
||||
<td><%= link_to 'Edit', edit_panel_gprs_back_end_locations_path(location) %></td>
|
||||
<td><%= link_to 'Destroy', location, method: :delete %>
|
||||
</tr>
|
||||
<% end %>
|
||||
<!-- </form> -->
|
||||
</tbody>
|
||||
</table>
|
||||
|
||||
<td><%= link_to 'New', new_panel_gprs_back_end_locations_path %></td>
|
||||
|
|
1
vendor/built_in_modules/gprs/app/views/panel/gprs/back_end/locations/new.html.erb
vendored
Normal file
1
vendor/built_in_modules/gprs/app/views/panel/gprs/back_end/locations/new.html.erb
vendored
Normal file
|
@ -0,0 +1 @@
|
|||
<%= render 'form' %>
|
0
vendor/built_in_modules/gprs/app/views/panel/gprs/back_end/locations/show.html.erb
vendored
Normal file
0
vendor/built_in_modules/gprs/app/views/panel/gprs/back_end/locations/show.html.erb
vendored
Normal file
|
@ -6,9 +6,7 @@ Rails.application.routes.draw do
|
|||
match "locations/get_locations" => "locations#get_locations"
|
||||
|
||||
resources :locations
|
||||
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
end
|
||||
|
|
14
vendor/built_in_modules/gprs/test/functional/panel/gprs/back_end/locations_controller_test.rb
vendored
Normal file
14
vendor/built_in_modules/gprs/test/functional/panel/gprs/back_end/locations_controller_test.rb
vendored
Normal file
|
@ -0,0 +1,14 @@
|
|||
require 'test_helper'
|
||||
|
||||
class Panel::Gprs::BackEnd::LocationsControllerTest < ActionController::TestCase
|
||||
test "should get index" do
|
||||
get :index
|
||||
assert_response :success
|
||||
end
|
||||
|
||||
test "should get edit" do
|
||||
get :edit
|
||||
assert_response :success
|
||||
end
|
||||
|
||||
end
|
4
vendor/built_in_modules/gprs/test/unit/helpers/panel/gprs/back_end/locations_helper_test.rb
vendored
Normal file
4
vendor/built_in_modules/gprs/test/unit/helpers/panel/gprs/back_end/locations_helper_test.rb
vendored
Normal file
|
@ -0,0 +1,4 @@
|
|||
require 'test_helper'
|
||||
|
||||
class Panel::Gprs::BackEnd::LocationsHelperTest < ActionView::TestCase
|
||||
end
|
Loading…
Reference in New Issue