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_with(model: @<%= model_resource_name %>) do |form| | |
- if @<%= singular_table_name %>.errors.any? | |
div style="color: red" | |
h2 = "#{pluralize(@<%= singular_table_name %>.errors.count, "error")} prohibited this <%= singular_table_name %> from being saved:" | |
ul | |
- @<%= singular_table_name %>.errors.each do |error| | |
li = error.full_message | |
<% attributes.each do |attribute| -%> | |
div |
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
.w3-row | |
p Test two, move element using Rails.ujs | |
/ This is a hidden form, payload may be usefull in other applications | |
= form_with( url:'/test/fire',method: :patch, html: {data: { type: "html", action: "ajax:success->testTwo#onPostSuccess",target:'testTwo.form' } },class:'w3-hide') do |form| | |
= form.text_area :payload, data: { target: "testTwo.payload" } | |
.w3-col.s6 | |
p Left list (Cleared) | |
ul | |
- session[:test_list].each do |k,v| |
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
module Jekyll | |
class UltravioletTag < Liquid::Block | |
require "Uv" | |
# This defines an uvhighlight tag for code highlighting using Ultraviolet (must [sudo] gem install ultraviolet and dependancies) | |
# Syntax for tag is {% uvhighlight code [theme] ["linenumb|linenos"]%} which is similar to the pygments call | |
# code is required, theme and linenumb optional and in any order | |
def initialize(tag_name, arg, tokens) | |
super | |
copy_files? # copy css files if not in css directory |
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 "ice_cube" | |
#require_relative "utilities/form_options_ext" | |
#require_relative "utilities/tag_ext" | |
module RecurringSelectHelper | |
module FormHelper | |
def select_recurring(object, method, default_schedules = nil, options = {}, html_options = {}) | |
if Rails::VERSION::STRING.to_f >= 4.0 | |
# === Rails 4 | |
RecurringSelectTag.new(object, method, self, default_schedules, options, html_options).render |
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
## app/models/assessable/scoring.rb | |
module Assessable | |
module Scoring | |
class Score | |
class Score | |
attr :post, :total_raw, :total_weighted, :scores | |
def initialize(assessment,post) | |
#@assessment = assessment |
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
/* | |
serialize library | |
Serialize is beta library that seriailizes deeply nested collection into a blob. | |
My need is that these collections never moved from a prototype implmentation in collections | |
versues a table approach. The system is still in use, with hopes of moving off of 4D, but not yet! | |
The current solution is to convert the collection to an objectTools object. While it works, it is a little. | |
slow, probably because as my parser. The xml is also bumping up against the 4.5 32k text limit. | |
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
<% | |
method "jsonParseSimple"($json) | |
// First convert any dates in IETF format to 4d date | |
$re1 := "~\"?(Jan|Feb|Mar|Apr|May|Jun|Jul|Aug|Sep|Oct|Nov|Dec)( \d\d*, \d{4})\"~" | |
$rp1 := "form.newDate(\"\1\2\")" | |
regex replace($re1; $json; $rp1; $json) | |
$json := trim($json) | |
if ($json[[1]] = "[") // if json is just an array, wrap in in an object |
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
# This is yet another attempt at doing the elusive combo box. | |
# Since I moved to jquery,I wanted to see if there was something out there | |
# that was better then what I found a few years ago. There was | |
# a jquery plugin, but I am not sure how it worked - didn't see where you could enter text! | |
# You should be able to either select from a pulldown list, or add an item that is not in the list. | |
# This in a nutshell overlays a 13em input text field over a 15em select tag. (css) | |
# There is a helper method build_combo_box where you send the form_builder object, the method, | |
# the choices and the current value. It builds the combo box. |
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
<% | |
/********************************************************************************** | |
jsonParseSimple | |
In => $json -> Text in JavaScript Object Notation(JSON) | |
Out => The JSON text parsed to an Active4D collection with some limitations. | |
Active4D cannot do everything that you can in JSON (JavaScript, Ruby, PHP etc). | |
You cannot have an array of mixed types as you can in other languages. |
NewerOlder