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 :description
|
||||||
field :longitude, type: Float
|
field :longitude, type: Float
|
||||||
field :latitude, type: Float
|
field :latitude, type: Float
|
||||||
|
|
||||||
end
|
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 @@
|
||||||
|
<table class="table main-list">
|
||||||
<!-- <form class="form-horizontal"> -->
|
<thead>
|
||||||
<%= form_for @newlocation, :url=>{:action => "create"}, :remote => true, :class=>"form-horizontal" do |f| %>
|
<tr>
|
||||||
<div class="control-group">
|
<th class="span1"><%= t('location.picture') %></th>
|
||||||
<label class="control-label" for="">Name</label>
|
<th class="span1"><%= t('location.name') %></th>
|
||||||
<div class="controls">
|
<th class="span1"><%= t('location.longitude') %></th>
|
||||||
<!-- <input type="text" id="" class="span4" placeholder="Taipei 101"> -->
|
<th class="span1"><%= t('location.latitude') %></th>
|
||||||
<%= f.text_field :name, :class=>"span4", :placeholder => "Area" %>
|
<th class="span3"><%= t('location.description') %></th>
|
||||||
</div>
|
<th class="span1"><%= t('location.edit') %></th>
|
||||||
</div>
|
<th class="span1"><%= t('location.delete') %></th>
|
||||||
<div class="control-group">
|
</tr>
|
||||||
<label class="control-label" for="">Picture</label>
|
</thead>
|
||||||
<div class="controls">
|
<tbody id="tbody_locations" class="sort-holder">
|
||||||
<!-- <input type="file" id=""> -->
|
<% @locations.each do |location| %>
|
||||||
<%= f.file_field :file %>
|
<tr class="with_action">
|
||||||
</div>
|
<td><%= image_tag(location.file, alt: location.file, size: "50x50" )%></td>
|
||||||
</div>
|
<td><%= location.name%></td>
|
||||||
<div class="control-group">
|
<td><%= location.longitude%></td>
|
||||||
<label class="control-label" for="">Coordinates</label>
|
<td><%= location.latitude%></td>
|
||||||
<div class="controls">
|
<td><%= location.description%></td>
|
||||||
<!-- <input type="text" id="" class="span2" placeholder="long"> -->
|
<td><%= link_to 'Edit', edit_panel_gprs_back_end_locations_path(location) %></td>
|
||||||
<%= f.text_field :longitude, :class=>"span2", :placeholder => "Longitude" %>
|
<td><%= link_to 'Destroy', location, method: :delete %>
|
||||||
<%= f.text_field :latitude, :class=>"span2", :placeholder => "Langitude" %>
|
</tr>
|
||||||
|
|
||||||
<!-- <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>
|
|
||||||
<% end %>
|
<% 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"
|
match "locations/get_locations" => "locations#get_locations"
|
||||||
|
|
||||||
resources :locations
|
resources :locations
|
||||||
|
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
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
|
Reference in New Issue