parent
146d877254
commit
66251c8d30
@ -0,0 +1,3 @@
|
||||
# Place all the behaviors and hooks related to the matching controller here.
|
||||
# All this logic will automatically be available in application.js.
|
||||
# You can use CoffeeScript in this file: http://jashkenas.github.com/coffee-script/
|
@ -0,0 +1,3 @@
|
||||
// Place all the styles related to the SystemMessages controller here.
|
||||
// They will automatically be included in application.css.
|
||||
// You can use Sass (SCSS) here: http://sass-lang.com/
|
@ -0,0 +1,83 @@
|
||||
class SystemMessagesController < ApplicationController
|
||||
# before_filter :message_author, :only => [:show]
|
||||
#
|
||||
# def message_author
|
||||
# if(!User.current.logged? && !token.nil?)
|
||||
#
|
||||
# User.current =try_to_autologin1
|
||||
# end
|
||||
# if @system_messages
|
||||
# render_403 :message => :notice_not_authorized_message
|
||||
# else
|
||||
# deny_access
|
||||
# end
|
||||
# end
|
||||
|
||||
def index
|
||||
@system_messages = SystemMessage.all
|
||||
end
|
||||
|
||||
# def show
|
||||
# @system_messages = SystemMessage.find(params[:id])
|
||||
# end
|
||||
|
||||
# GET /products/new
|
||||
# def new
|
||||
# @product = Product.new
|
||||
# end
|
||||
|
||||
# GET /products/1/edit
|
||||
# def edit
|
||||
# end
|
||||
|
||||
# POST /products
|
||||
# POST /products.json
|
||||
def create
|
||||
@system_messages = SystemMessage.new
|
||||
@system_messages.content = params[:system_message][:content]
|
||||
@system_messages.user_id = User.current.id
|
||||
respond_to do |format|
|
||||
if @system_messages.save
|
||||
format.html {redirect_to system_messages_url(@project)}
|
||||
flash[:notice] = l(:notice_successful_message)
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
# PATCH/PUT /products/1
|
||||
# PATCH/PUT /products/1.json
|
||||
# def update
|
||||
# respond_to do |format|
|
||||
# if @product.update(product_params)
|
||||
# format.html { redirect_to @product, notice: 'Product was successfully updated.' }
|
||||
# format.json { render :show, status: :ok, location: @product }
|
||||
# else
|
||||
# format.html { render :edit }
|
||||
# format.json { render json: @product.errors, status: :unprocessable_entity }
|
||||
# end
|
||||
# end
|
||||
# end
|
||||
|
||||
# DELETE /products/1
|
||||
# DELETE /products/1.json
|
||||
# def destroy
|
||||
# @system_messages.destroy
|
||||
# respond_to do |format|
|
||||
# format.html { redirect_to products_url, notice: 'Product was successfully destroyed.' }
|
||||
# format.json { head :no_content }
|
||||
# end
|
||||
# end
|
||||
|
||||
# private
|
||||
# # Use callbacks to share common setup or constraints between actions.
|
||||
# def set_product
|
||||
# @product = Product.find(params[:id])
|
||||
# end
|
||||
#
|
||||
# # Never trust parameters from the scary internet, only allow the white list through.
|
||||
# def message_params
|
||||
# params.require(:admin_system_messages).permit(:content)
|
||||
# end
|
||||
|
||||
|
||||
end
|
@ -0,0 +1,2 @@
|
||||
module SystemMessagesHelper
|
||||
end
|
@ -0,0 +1,4 @@
|
||||
class SystemMessage < ActiveRecord::Base
|
||||
attr_accessible :content, :id, :user_id
|
||||
belongs_to :user
|
||||
end
|
@ -0,0 +1,14 @@
|
||||
<h3 style="float: left">
|
||||
<%=l(:label_system_message)%>
|
||||
</h3><br/>
|
||||
<div style="padding-top: 20px; padding-left: 5px;">
|
||||
<%= form_for(@admin_messages) do |f| %>
|
||||
<div class="field">
|
||||
<%= f.text_area :content %>
|
||||
</div>
|
||||
<div class="actions">
|
||||
<%= f.submit l(:label_submit),:class => "small" %>
|
||||
</div>
|
||||
<% end %>
|
||||
</div>
|
||||
|
@ -0,0 +1,3 @@
|
||||
<% @system_messages.each do |sm| %>
|
||||
<ul><li><%= sm.content %></li></ul>
|
||||
<% end %>
|
@ -0,0 +1,11 @@
|
||||
class CreateSystemMessages < ActiveRecord::Migration
|
||||
def change
|
||||
create_table :system_messages do |t|
|
||||
t.integer :id
|
||||
t.integer :user_id
|
||||
t.string :content
|
||||
|
||||
t.timestamps
|
||||
end
|
||||
end
|
||||
end
|
@ -0,0 +1,5 @@
|
||||
require 'rails_helper'
|
||||
|
||||
RSpec.describe SystemMessagesController, :type => :controller do
|
||||
|
||||
end
|
@ -0,0 +1,8 @@
|
||||
FactoryGirl.define do
|
||||
factory :system_message do
|
||||
id 1
|
||||
user_id 1
|
||||
content "MyString"
|
||||
end
|
||||
|
||||
end
|
@ -0,0 +1,5 @@
|
||||
require 'rails_helper'
|
||||
|
||||
RSpec.describe SystemMessage, :type => :model do
|
||||
pending "add some examples to (or delete) #{__FILE__}"
|
||||
end
|
Loading…
Reference in new issue