This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
if download | |
S3Lib::download_from_s3(new_resource.bucket, new_resource.key, new_resource.path, new_resource.aws_access_key, new_resource.aws_secret_access_key) | |
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
require "net/http" | |
require "uri" | |
uri = URI.parse("http://SERVERURL:8111/httpAuth/app/rest/server/backup") | |
http = Net::HTTP.new(uri.host, uri.port) | |
request = Net::HTTP::Post.new(uri.request_uri) | |
request.set_form_data({ | |
"includeConfigs" => "true", |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
class ReportCheck < ActiveRecord::Base | |
belongs_to :report | |
belongs_to :check | |
attr_accessible :check_id | |
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
class Report < ActiveRecord::Base | |
attr_accessible :customer, :report_checks_attributes | |
has_many :report_checks, :dependent => :destroy | |
has_many :checks, through: :report_checks | |
accepts_nested_attributes_for :report_checks, reject_if: :all_blank, allow_destroy: true | |
validate :check_should_be_unique |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<div class="items"> | |
<% @report.report_checks.order(check_id: :asc).each do |report_check| %> | |
<div class="nested-fields"> | |
<div class="item"> | |
<%= form_for report_check, remote: true do |f| %> | |
<h3 class="text-center"> | |
<%= report_check.check.name %> | |
</h3> | |
<p>Description: <%= report_check.check.description %></p> | |
<p>Category: <%= report_check.check.category %></p> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<div class="row"> | |
<%= link_to "Edit", edit_report_path(@report), class: "btn btn-primary pull-right" %> | |
<%= link_to "PDF", report_path(@report, format: "pdf"), class: "btn btn-success pull-right" %> | |
</div> | |
<div class="items"> | |
<% @report.report_checks.order(check_id: :asc).each do |report_check| %> | |
<div class="nested-fields"> | |
<div class="item"> | |
<%= form_for report_check, remote: true do |f| %> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Processing by ReportChecksController#update as JS | |
Parameters: {"utf8"=>"✓", "report_check"=>{"score"=>"4", "recommendation"=>"wwas", "analysis"=>"wwd2", "_destroy"=>"false"}, "commit"=>"Set Score", "id"=>"2"} | |
ReportCheck Load (1.0ms) SELECT "report_checks".* FROM "report_checks" WHERE "report_checks"."id" = $1 LIMIT 1 [["id", 2]] | |
(0.1ms) BEGIN | |
(0.1ms) ROLLBACK | |
Completed 500 Internal Server Error in 4ms (ActiveRecord: 1.2ms) | |
ActiveRecord::UnknownAttributeError (unknown attribute '_destroy' for ReportCheck.): | |
app/controllers/report_checks_controller.rb:4:in `update' |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
$(function(){ | |
$("form").submit(function(event){ | |
// this debugger should be hit when you click the submit button! | |
debugger; | |
}); | |
}); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
[0,1,2,3,4].each do |number| | |
ReportCheck.where(report_id: @report.id).each do |report_check| | |
ReportCheck.find(report_check.id).update_attributes(score: number) | |
end | |
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
$('form#reportcheck').submit(function(){ | |
var valuesToSubmit = $(this).serialize(); | |
$.ajax({ | |
type: "POST", | |
url: $(this).attr('action'), //sumbits it to the given url of the form | |
data: valuesToSubmit, | |
dataType: "JSON" // you want a difference between normal and ajax-calls, and json is standard | |
}).success(function(json){ | |
console.log("success", json); | |
}); |
OlderNewer