refine the location module done
This commit is contained in:
parent
dbfc70e520
commit
e6a9555dd8
|
@ -1,10 +1,10 @@
|
|||
class Panel::Gprs::BackEnd::LocationsController < OrbitBackendController
|
||||
|
||||
before_filter :clean_values, :only => [:create, :update]
|
||||
#before_filter :clean_values, :only => [:create, :update]
|
||||
|
||||
before_filter :force_order_for_visitor,:only => [:index, :new, :edit, :delete]
|
||||
before_filter :force_order_for_user,:except => :get_locations
|
||||
before_filter :for_app_sub_manager,:except => [:index, :new, :edit, :delete, :get_locations]
|
||||
#before_filter :for_app_sub_manager,:except => [:index, :new, :edit, :delete, :get_locations]
|
||||
|
||||
def index
|
||||
@locations = Location.all
|
||||
|
@ -28,7 +28,7 @@ class Panel::Gprs::BackEnd::LocationsController < OrbitBackendController
|
|||
end
|
||||
|
||||
def show
|
||||
@location = Location..find(params[:id])
|
||||
@location = Location.find(params[:id])
|
||||
respond_to do |format|
|
||||
format.html
|
||||
format.json { render json: @location }
|
||||
|
@ -36,22 +36,22 @@ class Panel::Gprs::BackEnd::LocationsController < OrbitBackendController
|
|||
end
|
||||
|
||||
def create
|
||||
debugger
|
||||
@location = Location.new(params[:location])
|
||||
if @location.save
|
||||
format.html { redirect_to @location }
|
||||
format.json { render json: @location, status: :created, location: @location }
|
||||
@location.save!
|
||||
redirect_to panel_gprs_back_end_locations_url
|
||||
end
|
||||
#render :action => "new"
|
||||
|
||||
def update
|
||||
@location = Location.find(params[:id])
|
||||
@location.update_attributes(params[:location])
|
||||
redirect_to panel_gprs_back_end_locations_url
|
||||
end
|
||||
|
||||
def destroy
|
||||
@location = Location..find(params[:id])
|
||||
@location = Location.find(params[:id])
|
||||
@location.destroy
|
||||
redirect_to panel_gprs_back_end_locations_url
|
||||
|
||||
respond_to do |format|
|
||||
format.json { head :no_content }
|
||||
end
|
||||
end
|
||||
|
||||
def get_locations
|
||||
|
|
|
@ -1,4 +1,3 @@
|
|||
<%= 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">
|
||||
|
@ -29,6 +28,3 @@
|
|||
<%= f.submit "Save", :class=>"btn" %>
|
||||
</div>
|
||||
</div>
|
||||
<% end %>
|
||||
<!-- </form> -->
|
||||
|
||||
|
|
|
@ -1,2 +1,4 @@
|
|||
<%= render 'form' %>
|
||||
<%= form_for @location, :url=> panel_gprs_back_end_location_path(@location), :html => { :class=>"form-horizontal"} do |f| %>
|
||||
<%= render :partial => 'form', :locals => {:f => f} %>
|
||||
<% end %>
|
||||
|
||||
|
|
|
@ -18,11 +18,11 @@
|
|||
<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 %>
|
||||
<td><%= link_to 'Edit', edit_panel_gprs_back_end_location_path(location) %></td>
|
||||
<td><%= link_to 'Destroy', panel_gprs_back_end_location_path(location), method: :delete , :confirm => t(:sure?) %></td>
|
||||
</tr>
|
||||
<% end %>
|
||||
</tbody>
|
||||
</table>
|
||||
|
||||
<td><%= link_to 'New', new_panel_gprs_back_end_locations_path %></td>
|
||||
<td><%= link_to 'New', new_panel_gprs_back_end_location_path %></td>
|
||||
|
|
|
@ -1 +1,3 @@
|
|||
<%= render 'form' %>
|
||||
<%= form_for @location, :url=> panel_gprs_back_end_locations_path, :html => { :class=>"form-horizontal"} do |f| %>
|
||||
<%= render :partial => 'form', :locals => {:f => f} %>
|
||||
<% end %>
|
||||
|
|
Loading…
Reference in New Issue