Skip to content

Instantly share code, notes, and snippets.

angular.module('tbApp').controller 'NewTimeEntryController', ['$element', '$scope', '$http', ($element, $scope, $http) ->
newTimeEntryController = @
newTimeEntryController.formSubmit = (form) ->
TimeEntry.create($scope.timeEntryForm.data(), $scope.day, $http).then(newTimeEntryController.postSuccess, newTimeEntryController.postError)
newTimeEntryController.postSuccess = (response) ->
console.log(response.data)
$scope.day.addTimeEntry(response.data)
newTimeEntryController.destroy()
@Piioo
Piioo / foo.patch
Created June 5, 2014 09:34
Expert outlet patch
From b613b92cf87bb5febb9f761105f05c8561b8a204 Mon Sep 17 00:00:00 2001
From: Piioo <Piotr.Szal@googlemail.com>
Date: Thu, 5 Jun 2014 11:32:51 +0200
Subject: [PATCH] tests with new outlet plugin system
---
.../connectors/www-post-info/expert_post.js.handlebars | 8 ++++++++
assets/javascripts/discourse/templates/expert_post.js.html | 5 -----
assets/javascripts/injectors/expert_post_injector.js.erb | 14 --------------
plugin.rb | 1 -
Discourse.AdsenseTopicAfterPostsView = Discourse.AdsenseView.extend({
templateName: "topic_after_posts",
location: null,
init: function(){
var self = this;
var post_number = this.get('post_number');
if ($.inArray(post_number, [1,3,8]) != -1 ) {
this.set('location', "topic_after_" + post_number + "_post");
$('body').on('didInsertElement'+post_number, function(){
@Piioo
Piioo / dfp.js
Last active August 29, 2015 14:01
<script type='text/javascript'>
var googletag = googletag || {};
googletag.cmd = googletag.cmd || [];
(function () {
var gads = document.createElement('script');
Discourse.AdsenseTopicListTopView = Discourse.AdsenseView.extend({
templateName: "topic_list_top",
didInsertElement: function() {
if(typeof adsbygoogle !== "undefined"){
try {
adsbygoogle.push({});
} catch (e) {}
}
Sass::SyntaxError - Undefined variable: "$primary_border_color".
(in /Users/pisz/work/rails/www/www2014/app/assets/stylesheets/desktop.scss:11):
sass (3.2.16) lib/sass/script/variable.rb:49:in `_perform'
sass (3.2.16) lib/sass/script/node.rb:40:in `perform'
sass (3.2.16) lib/sass/script/list.rb:71:in `block in _perform'
sass (3.2.16) lib/sass/script/list.rb:71:in `_perform'
sass (3.2.16) lib/sass/script/node.rb:40:in `perform'
sass (3.2.16) lib/sass/tree/visitors/perform.rb:298:in `visit_prop'
sass (3.2.16) lib/sass/tree/visitors/base.rb:37:in `visit'
sass (3.2.16) lib/sass/tree/visitors/perform.rb:100:in `visit'
/**
Sets up the PageTracking hook.
**/
Discourse.addInitializer(function() {
var pageTracker = Discourse.PageTracker.current();
pageTracker.start();
// Out of the box, Discourse tries to track google analytics
// if it is present
if (typeof window._gaq !== 'undefined') {
b61f24d89806d16ef6e980c10a068434:
path: 5
---
{{#if Discourse.Mobile.mobileView}}
{{adsenseBlock "320" "50" "topic_bottom_mobile"}}
{{else}}
{{adsenseBlock "728" "90" "topic_bottom"}}
{{/if}}
Template:
<div>
{{#if category}}
<div class="item">
{{categoryBadge category}}
<i {{action removeCategory}} class="fa fa-times"></i>
</div>
{{else}}
<input class='interests-group auto-complete{{unbound view.index}}' type='text'>
{{/if}}
@Piioo
Piioo / gist:9889746
Created March 31, 2014 10:48
This is not the expert
### foo.js.handlebars
{{#each suggested_experts.experts}}
{{this}}
{{view Discourse.ExpertExpansionView foo=this }}
{{usernmae}}
{{/each}}
### expert_expansion_view.js
Discourse.ExpertExpansionView = Discourse.ContainerView.extend({