update with changes from Production branch
This commit is contained in:
8
app/views/plugins/_plugins.html.erb
Normal file
8
app/views/plugins/_plugins.html.erb
Normal file
@ -0,0 +1,8 @@
|
||||
<% if @plugin_windows.blank? %>
|
||||
<h4>All plugins are attached to a window.</h4>
|
||||
<% else %>
|
||||
<h4>Click a rectangle to view that Plugin in a dashboard window.</h4>
|
||||
<% @plugin_windows.each do |plugin| %>
|
||||
<div id="plugin-<%=plugin.id%>" class="ioplugin ui-widget-content addportlet"><%= plugin.name %></div>
|
||||
<% end %>
|
||||
<% end %>
|
3
app/views/plugins/default.css
Normal file
3
app/views/plugins/default.css
Normal file
@ -0,0 +1,3 @@
|
||||
<style type="text/css">
|
||||
body { background-color: #ddd; }
|
||||
</style>
|
13
app/views/plugins/default.html
Normal file
13
app/views/plugins/default.html
Normal file
@ -0,0 +1,13 @@
|
||||
<html>
|
||||
<head>
|
||||
|
||||
%%PLUGIN_CSS%%
|
||||
%%PLUGIN_JAVASCRIPT%%
|
||||
|
||||
</head>
|
||||
<body>
|
||||
|
||||
my plugin
|
||||
|
||||
</body>
|
||||
</html>
|
3
app/views/plugins/default.js
Normal file
3
app/views/plugins/default.js
Normal file
@ -0,0 +1,3 @@
|
||||
<script type="text/javascript">
|
||||
document.write('<div>javascript active</div>');
|
||||
</script>
|
109
app/views/plugins/edit.html.erb
Normal file
109
app/views/plugins/edit.html.erb
Normal file
@ -0,0 +1,109 @@
|
||||
<div class="col-sm-8 col-xs-8">
|
||||
|
||||
<ol class="breadcrumb">
|
||||
<li><%= link_to t(:plugins), plugins_path %></li>
|
||||
<li><%= link_to plugin_path(@plugin.id) do %> <%= t(:plugin) %> <%= @plugin.id %><% end %></li>
|
||||
<li class="active"><%= t(:edit) %></li>
|
||||
</ol>
|
||||
|
||||
<%= form_for @plugin, :html => {:method => 'put', :class => 'form-horizontal'} do |c| %>
|
||||
<%= error_messages_for 'plugin', :header_message => t(:try_again), :message => t(:plugin_error) %>
|
||||
<input name='userlogin' class='userlogin' />
|
||||
|
||||
<div class="form-group">
|
||||
<div class="col-sm-offset-2 col-sm-10 col-xs-offset-3 col-xs-6">
|
||||
<div class="checkbox">
|
||||
<label>
|
||||
<%= c.check_box :private_flag %>
|
||||
<%= t(:plugin_private_flag) %>
|
||||
</label>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="form-group">
|
||||
<label class="col-sm-2 col-xs-3 control-label"><%= t(:plugin_name) %></label>
|
||||
<div class="col-sm-10 col-xs-6"><%= c.text_field :name, :class => 'form-control' %></div>
|
||||
</div>
|
||||
|
||||
<div class="form-group">
|
||||
<label class="col-sm-2 col-xs-3 control-label"><%= t(:plugin_html) %></label>
|
||||
<div class="col-sm-10 col-xs-6"><%= c.text_area :html, :class => 'form-control', :rows => 14 %></div>
|
||||
</div>
|
||||
|
||||
<div class="form-group">
|
||||
<label class="col-sm-2 col-xs-3 control-label"><%= t(:plugin_css) %></label>
|
||||
<div class="col-sm-10 col-xs-6"><%= c.text_area :css, :class => 'form-control', :rows => 14 %></div>
|
||||
</div>
|
||||
|
||||
<div class="form-group">
|
||||
<label class="col-sm-2 col-xs-3 control-label"><%= t(:plugin_js) %></label>
|
||||
<div class="col-sm-10 col-xs-6"><%= c.text_area :js, :class => 'form-control', :rows => 14 %></div>
|
||||
</div>
|
||||
|
||||
<div class="form-group">
|
||||
<label class="col-sm-2 control-label"></label>
|
||||
<div class="col-sm-10"><p class="form-control-static"><%= c.submit t(:plugin_edit), :class => 'btn btn-primary' %></p></div>
|
||||
</div>
|
||||
|
||||
<% end %>
|
||||
|
||||
<br /><br />
|
||||
|
||||
<h3><%= t(:plugin_delete_message) %></h3>
|
||||
<%= button_to t(:plugin_delete), plugin_path(@plugin.id), :method => 'delete', :data => { :confirm => t(:confirm_plugin_delete) }, :class => 'btn btn-danger' %>
|
||||
|
||||
</div>
|
||||
|
||||
<script type="text/javascript">
|
||||
// when document is ready
|
||||
$(function() {
|
||||
|
||||
// allow tabs to work in textareas
|
||||
$("textarea").tabby();
|
||||
|
||||
// clears status message
|
||||
function clearStatus() {
|
||||
setTimeout(function() {
|
||||
$('#status').html('');
|
||||
}, 2500);
|
||||
}
|
||||
|
||||
// event to capture update button click
|
||||
$('#plugin_submit').click(
|
||||
function() {
|
||||
$.update(
|
||||
// url to post to
|
||||
'/plugins/ajax_update/<%= @plugin.id %>',
|
||||
|
||||
// data to send
|
||||
{
|
||||
plugin:
|
||||
{
|
||||
name: $('#plugin_name').val(),
|
||||
private_flag: $('#plugin_private_flag').is(':checked'),
|
||||
html: $('#plugin_html').val(),
|
||||
css: $('#plugin_css').val(),
|
||||
js: $('#plugin_js').val()
|
||||
}
|
||||
},
|
||||
|
||||
// if post was successful
|
||||
function (response) {
|
||||
var status = (response == '1') ? '<%= t(:saved) %>' : '<%= t(:saved_error) %>';
|
||||
$('#status').html(status);
|
||||
clearStatus();
|
||||
},
|
||||
|
||||
// if post failed
|
||||
function (response) {
|
||||
$('#status').html('<%= t(:saved_error) %>');
|
||||
clearStatus();
|
||||
}
|
||||
);
|
||||
return false;
|
||||
});
|
||||
|
||||
});
|
||||
</script>
|
||||
|
43
app/views/plugins/index.html.erb
Normal file
43
app/views/plugins/index.html.erb
Normal file
@ -0,0 +1,43 @@
|
||||
<div class="row">
|
||||
<div class="col-xs-12 col-sm-6">
|
||||
|
||||
<h4 class='breadcrumb'><%= t(:plugins) %></h4>
|
||||
|
||||
<% if @plugins.length > 0 %>
|
||||
<table class="table table-striped table-bordered">
|
||||
<tr>
|
||||
<th><%= t(:plugin_name) %></th>
|
||||
<th><%= t(:action) %></th>
|
||||
</tr>
|
||||
|
||||
<% @plugins.each do |p| %>
|
||||
<tr>
|
||||
<td><%= link_to p.name, plugin_path(p.id) %></td>
|
||||
<td><%= link_to t(:edit), edit_plugin_path(p.id) %></td>
|
||||
</tr>
|
||||
<% end %>
|
||||
|
||||
</table>
|
||||
|
||||
<br /><br />
|
||||
<% end %>
|
||||
|
||||
<%= form_for :plugin do |p| %>
|
||||
<input name='userlogin' class='userlogin' />
|
||||
<%= p.submit t(:plugin_create), :class => 'btn btn-primary' %>
|
||||
<% end %>
|
||||
</div>
|
||||
|
||||
<div id="sidebar" class="col-xs-12 col-sm-6">
|
||||
<h4 class="breadcrumb"><%= t(:help) %></h4>
|
||||
|
||||
<div class="col-pad">
|
||||
<%= t(:help_plugins) %>
|
||||
<ul>
|
||||
<li><a href="http://community.thingspeak.com/tutorials/google/display-a-google-gauge-visualization-using-thingspeak-plugins/" target="_blank">Google Gauge Tutorial</a></li>
|
||||
</ul>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
</div>
|
||||
|
1
app/views/plugins/show.html.erb
Normal file
1
app/views/plugins/show.html.erb
Normal file
@ -0,0 +1 @@
|
||||
<%= raw(@output) %>
|
Reference in New Issue
Block a user