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 ng-app='MyModule'> | |
<div ng-controller='DefaultCtrl'> | |
<input auto-complete ui-items="names" ng-model="selected"> | |
selected = {{selected}} | |
</div> | |
</div> | |
function DefaultCtrl($scope) { | |
$scope.names = ["john", "bill", "charlie", "robert", "alban", "oscar", "marie", "celine", "brad", "drew", "rebecca", "michel", "francis", "jean", "paul", "pierre", "nicolas", "alfred", "gerard", "louis", "albert", "edouard", "benoit", "guillaume", "nicolas", "joseph"]; | |
} |
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
search_scope = Delivery.accessible_by(current_ability, :read) | |
search_scope = search_scope.where(state: :quotation_request). | |
joins(" inner join (select * from (select *, max(id) over (partition by delivery_id) from quotation_requests)t where t.max = t.id)tt on tt.delivery_id = deliveries.id "). | |
includes(:quotation_requests). | |
where(quotation_requests: {status: params[:q][:status_in].select(&:present?) }) | |
search_scope = search_scope.search(params[:q]) | |
search_scope = search_scope.order("quotation_requests.id DESC") | |
set_collection_ivar(search_scope.paginate(page: params[:page], per_page: 20)) |
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
Rails.logger.info 'Starting Example plugin for RedMine' | |
Redmine::Plugin.register :sample_plugin do | |
name 'Example plugin' | |
author 'Author name' | |
description 'This is a sample plugin for Redmine' | |
version '0.0.1' | |
settings :default => {'sample_setting' => 'value', 'foo'=>'bar'}, :partial => 'settings/sample_plugin_settings' | |
# This plugin adds a project module |
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.postNew = function (delivery, tender, success, error) { | |
var deliveryCopy = angular.copy(delivery); | |
delete deliveryCopy.state; | |
var sendPickupRequest = deliveryCopy.sendPickupRequest; | |
delete deliveryCopy.sendPickupRequest; | |
.... | |
$http.post('/deliveries.json', { | |
delivery: deliveryCopy, |
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
$scope.addZoomListener = function () { | |
$scope.zoomListener = google.maps.event.addListener($scope.map, 'zoom_changed', function () { | |
//when zoom changed we need to clear all old markers | |
// as it changes regions to their parents etc | |
$scope.calculatePortInfoPosition(); | |
$scope.cleanAllMarkers(); | |
$scope.reloadMarkers(); | |
}); | |
}; |
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 DemoTemplates | |
class StockProvisioning < Workflow::OperationTemplate | |
def resolve_dependency operation | |
resource = operation.data[:resource] | |
# resource is order. | |
# for every order line we check if product needs provisioning | |
# (if it's amount lower that provisioning limit) | |
resource.order_lines.map(:product).any?{|p| p.need_provisioning? } | |
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
source 'https://rubygems.org' | |
gem 'thin' | |
gem 'rails', '4.2.0' | |
gem 'sqlite3' | |
gem 'sass-rails', '~> 5.0' | |
gem 'uglifier', '>= 1.3.0' | |
gem 'coffee-rails', '~> 4.1.0' | |
gem 'jquery-rails' | |
gem 'turbolinks' |
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 User < ApplicationRecord | |
... | |
after_create :start_newcomer_process | |
def start_newcomer_process | |
template = RailsWorkflow::ProcessTemplate.find_by_title('New User Process') | |
RailsWorkflow::ProcessManager.start_process( | |
template.id, | |
{ user: self, url_path: 'user_path', url_params: self } | |
) |
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 current_operation.present? %> | |
<h1><%= current_operation.title %></h1> | |
<% end %> | |
<h3>User</h3> | |
<p>Email: <%= @user.email if @user.email %></p> | |
<% if current_operation.present? %> | |
<%= link_to 'Complete', user_path(@user), method: :put, class: "btn btn-primary" %> | |
<% 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 UsersController < ApplicationController | |
... | |
def update | |
if current_operation | |
current_operation.complete | |
redirect_to users_path | |
end | |
end | |
end |
OlderNewer