--------------------------------------------------------------------------------
/src/app/home/README.md:
--------------------------------------------------------------------------------
1 | # The `src/app/home` Directory
2 |
3 | ## Overview
4 |
5 | ```
6 | src/
7 | |- app/
8 | | |- home/
9 | | | |- home.js
10 | | | |- home.less
11 | | | |- home.spec.js
12 | | | |- home.tpl.html
13 | ```
14 |
15 | - `home.js` - defines the module.
16 | - `home.less` - module-specific styles; this file is imported into
17 | `src/less/main.less` manually by the developer.
18 | - `home.spec.js` - module unit tests.
19 | - `home.tpl.html` - the route template.
20 |
21 | ## `home.js`
22 |
23 | This boilerplate is too simple to demonstrate it, but `src/app/home` could have
24 | several sub-folders representing additional modules that would then be listed
25 | as dependencies of this one. For example, a `note` section could have the
26 | submodules `note.create`, `note.delete`, `note.search`, etc.
27 |
28 | Regardless, so long as dependencies are managed correctly, the build process
29 | will automatically take take of the rest.
30 |
31 | The dependencies block is also where component dependencies should be
32 | specified, as shown below.
33 |
34 | ```js
35 | angular.module( 'ngBoilerplate.home', [
36 | 'ui.router',
37 | 'titleService',
38 | 'plusOne'
39 | ])
40 | ```
41 |
42 | Each section or module of the site can also have its own routes. AngularJS will
43 | handle ensuring they are all available at run-time, but splitting it this way
44 | makes each module more self-contained. We use [ui-router](https://github.com/angular-ui/ui-router) to create
45 | a state for our 'home' page. We set the url we'd like to see in the address bar
46 | as well as the controller and template file to load. Specifying "main" as our view
47 | means the controller and template will be loaded into the element
48 | of the root template (aka index.html). Read more over at the [ui-router wiki](https://github.com/angular-ui/ui-router/wiki).
49 | Finally we add a custom data property, pageTitle, which will be used to set the page's
50 | title (see the app.js controller).
51 |
52 | ```js
53 | .config(function config( $stateProvider ) {
54 | $stateProvider.state( 'home', {
55 | url: '/home',
56 | views: {
57 | "main": {
58 | controller: 'HomeCtrl',
59 | templateUrl: 'home/home.tpl.html'
60 | }
61 | },
62 | data:{ pageTitle: 'Home' }
63 | });
64 | })
65 | ```
66 |
67 | And of course we define a controller for our route, though in this case it does
68 | nothing.
69 |
70 | ```js
71 | .controller( 'HomeCtrl', function HomeController( $scope ) {
72 | })
73 | ```
74 |
--------------------------------------------------------------------------------
/vendor/src/app/home/README.md:
--------------------------------------------------------------------------------
1 | # The `src/app/home` Directory
2 |
3 | ## Overview
4 |
5 | ```
6 | src/
7 | |- app/
8 | | |- home/
9 | | | |- home.js
10 | | | |- home.less
11 | | | |- home.spec.js
12 | | | |- home.tpl.html
13 | ```
14 |
15 | - `home.js` - defines the module.
16 | - `home.less` - module-specific styles; this file is imported into
17 | `src/less/main.less` manually by the developer.
18 | - `home.spec.js` - module unit tests.
19 | - `home.tpl.html` - the route template.
20 |
21 | ## `home.js`
22 |
23 | This boilerplate is too simple to demonstrate it, but `src/app/home` could have
24 | several sub-folders representing additional modules that would then be listed
25 | as dependencies of this one. For example, a `note` section could have the
26 | submodules `note.create`, `note.delete`, `note.search`, etc.
27 |
28 | Regardless, so long as dependencies are managed correctly, the build process
29 | will automatically take take of the rest.
30 |
31 | The dependencies block is also where component dependencies should be
32 | specified, as shown below.
33 |
34 | ```js
35 | angular.module( 'ngBoilerplate.home', [
36 | 'ui.router',
37 | 'titleService',
38 | 'plusOne'
39 | ])
40 | ```
41 |
42 | Each section or module of the site can also have its own routes. AngularJS will
43 | handle ensuring they are all available at run-time, but splitting it this way
44 | makes each module more self-contained. We use [ui-router](https://github.com/angular-ui/ui-router) to create
45 | a state for our 'home' page. We set the url we'd like to see in the address bar
46 | as well as the controller and template file to load. Specifying "main" as our view
47 | means the controller and template will be loaded into the element
48 | of the root template (aka index.html). Read more over at the [ui-router wiki](https://github.com/angular-ui/ui-router/wiki).
49 | Finally we add a custom data property, pageTitle, which will be used to set the page's
50 | title (see the app.js controller).
51 |
52 | ```js
53 | .config(function config( $stateProvider ) {
54 | $stateProvider.state( 'home', {
55 | url: '/home',
56 | views: {
57 | "main": {
58 | controller: 'HomeCtrl',
59 | templateUrl: 'home/home.tpl.html'
60 | }
61 | },
62 | data:{ pageTitle: 'Home' }
63 | });
64 | })
65 | ```
66 |
67 | And of course we define a controller for our route, though in this case it does
68 | nothing.
69 |
70 | ```js
71 | .controller( 'HomeCtrl', function HomeController( $scope ) {
72 | })
73 | ```
74 |
--------------------------------------------------------------------------------
/src/app/channels/new_channel.tpl.html:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 |
8 |
Create a new channel
9 |
10 |
11 |
45 |
46 |
47 |
48 |
--------------------------------------------------------------------------------
/src/app/channels/view/channel-view.js:
--------------------------------------------------------------------------------
1 |
2 | angular.module('Cimba.channels.view', ['ui.router'])
3 |
4 | .config(function ChannelsConfig($stateProvider) {
5 | $stateProvider.state('view', {
6 | url: '/channels/view/*path',
7 | views: {
8 | 'main': {
9 | controller: 'ChannelViewCtrl',
10 | templateUrl: 'channels/view/channel-view.tpl.html'
11 | }
12 | },
13 | data: {}
14 | });
15 | })
16 |
17 | .controller('ChannelViewCtrl', function ChannelViewController($scope, $stateParams, $location, $http, noticesData) {
18 | //console.log("channel view ctrl"); //debug
19 |
20 | //put the post data that is saved in local storage into the posting text box
21 | if(sessionStorage.getItem($scope.$parent.postData[$scope.currentUrl])&&sessionStorage.getItem($scope.$parent.postData[$scope.currentUrl])!='undefined'){
22 | $scope.postbody = sessionStorage.getItem($scope.$parent.postData[$scope.currentUrl]);
23 | }else{
24 | $scope.postbody = '';
25 | }
26 | $scope.path = $stateParams.path;
27 | $scope.currentUrl = $location.absUrl();
28 |
29 | $scope.safeUri = function (uri) {
30 | return uri.replace(/^https?:\/\//,'');
31 | };
32 |
33 | var webid = $scope.$parent.userProfile.webid;
34 | $scope.chanUri = "https://" + $scope.path;
35 | if($scope.channels[$scope.chanUri]) {
36 | console.log("found");
37 | var ch = $scope.channels[$scope.chanUri];
38 | $scope.$parent.getPosts(ch.uri, ch.title);
39 | } else if ($scope.userProfile.channels[$scope.chanUri]) {
40 | $scope.channels[$scope.chanUri] = $scope.userProfile.channels[$scope.chanUri];
41 | var ch2 = $scope.channels[$scope.chanUri];
42 | $scope.$parent.getPosts(ch2.uri, ch2.title);
43 | } else {
44 | console.log("not found");
45 | $scope.$parent.getChannel($scope.chanUri);
46 | }
47 |
48 | //save what is currently in the new post text box to local storage
49 | $scope.savePostData=function(postBody){
50 | var currentPost = postBody;
51 | sessionStorage.setItem($scope.$parent.postData[$scope.currentUrl], currentPost, $scope.currentUrl);
52 | };
53 |
54 | //clears post data from local storage
55 | $scope.clearPostData=function(){
56 | sessionStorage.removeItem($scope.$parent.postData[$scope.currentUrl]);
57 | };
58 |
59 | })
60 |
61 | .directive('listPosts', function () {
62 | return {
63 | replace: true,
64 | restrict: 'E',
65 | templateUrl: 'channels/view/posts.tpl.html'
66 | };
67 | });
--------------------------------------------------------------------------------
/src/app/posts/new_post.tpl.html:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
31 |
32 |
33 |
--------------------------------------------------------------------------------
/vendor/src/app/login/login.js:
--------------------------------------------------------------------------------
1 | /**
2 | * Login page
3 | */
4 | angular.module( 'Cimba.login', [
5 | 'ui.router'
6 | ])
7 |
8 | /**
9 | * Each section or module of the site can also have its own routes. AngularJS
10 | * will handle ensuring they are all available at run-time, but splitting it
11 | * this way makes each module more "self-contained".
12 | */
13 | .config(function LoginConfig( $stateProvider ) {
14 | $stateProvider.state( 'login', {
15 | url: '/login',
16 | views: {
17 | "main": {
18 | controller: 'LoginCtrl',
19 | templateUrl: 'login/login.tpl.html'
20 | }
21 | },
22 | data:{ pageTitle: 'Login' }
23 | });
24 | })
25 |
26 | /**
27 | * And of course we define a controller for our route.
28 | */
29 | .controller( 'LoginCtrl', function LoginController( $scope, $http, $location, $sce ) {
30 |
31 | // login/signup widget source
32 | var providerURI = 'http://localhost/signup/index.html?ref=';
33 |
34 | // set the parameter in the src of iframe
35 | $scope.signupWidget = $sce.trustAsResourceUrl(providerURI+window.location.protocol+'//'+window.location.host);
36 |
37 | // login user into the app
38 | $scope.authenticate = function(webid) {
39 | if (webid && (webid.substr(0, 4) == 'http')) {
40 | $scope.userProfile = {};
41 | $scope.userProfile.webid = webid;
42 | $scope.$parent.loginSuccess = true;
43 | // index or update current WebID on webizen.org
44 | $http.get('http://api.webizen.org/v1/search', {
45 | params: {
46 | q: webid
47 | }
48 | });
49 | // set the user in the main controller and redirect to home page
50 | $scope.$parent.userProfile = $scope.userProfile;
51 | $location.path('/home');
52 | } else {
53 | notify('Error', 'WebID-TLS authentication failed.');
54 | }
55 | $scope.showLogin = false;
56 | $scope.$apply();
57 | };
58 |
59 | $scope.hideMenu = function() {
60 | $scope.$parent.showMenu = false;
61 | };
62 |
63 | // Event listener for login (from child iframe)
64 | var eventMethod = window.addEventListener ? "addEventListener" : "attachEvent";
65 | var eventListener = window[eventMethod];
66 | var messageEvent = eventMethod == "attachEvent" ? "onmessage" : "message";
67 |
68 | // Listen to message from child window
69 | eventListener(messageEvent,function(e) {
70 | if (e.data.slice(0,5) == 'User:') {
71 | console.log(e.data);
72 | $scope.authenticate(e.data.slice(5, e.data.length), true);
73 | }
74 | if (e.data.slice(0,6) == "cancel") {
75 | $scope.showLogin = false;
76 | $scope.$apply();
77 | }
78 | },false);
79 |
80 | });
81 |
--------------------------------------------------------------------------------
/vendor/jquery/src/core/ready.js:
--------------------------------------------------------------------------------
1 | define([
2 | "../core",
3 | "../core/init",
4 | "../deferred"
5 | ], function( jQuery ) {
6 |
7 | // The deferred used on DOM ready
8 | var readyList;
9 |
10 | jQuery.fn.ready = function( fn ) {
11 | // Add the callback
12 | jQuery.ready.promise().done( fn );
13 |
14 | return this;
15 | };
16 |
17 | jQuery.extend({
18 | // Is the DOM ready to be used? Set to true once it occurs.
19 | isReady: false,
20 |
21 | // A counter to track how many items to wait for before
22 | // the ready event fires. See #6781
23 | readyWait: 1,
24 |
25 | // Hold (or release) the ready event
26 | holdReady: function( hold ) {
27 | if ( hold ) {
28 | jQuery.readyWait++;
29 | } else {
30 | jQuery.ready( true );
31 | }
32 | },
33 |
34 | // Handle when the DOM is ready
35 | ready: function( wait ) {
36 |
37 | // Abort if there are pending holds or we're already ready
38 | if ( wait === true ? --jQuery.readyWait : jQuery.isReady ) {
39 | return;
40 | }
41 |
42 | // Remember that the DOM is ready
43 | jQuery.isReady = true;
44 |
45 | // If a normal DOM Ready event fired, decrement, and wait if need be
46 | if ( wait !== true && --jQuery.readyWait > 0 ) {
47 | return;
48 | }
49 |
50 | // If there are functions bound, to execute
51 | readyList.resolveWith( document, [ jQuery ] );
52 |
53 | // Trigger any bound ready events
54 | if ( jQuery.fn.triggerHandler ) {
55 | jQuery( document ).triggerHandler( "ready" );
56 | jQuery( document ).off( "ready" );
57 | }
58 | }
59 | });
60 |
61 | /**
62 | * The ready event handler and self cleanup method
63 | */
64 | function completed() {
65 | document.removeEventListener( "DOMContentLoaded", completed, false );
66 | window.removeEventListener( "load", completed, false );
67 | jQuery.ready();
68 | }
69 |
70 | jQuery.ready.promise = function( obj ) {
71 | if ( !readyList ) {
72 |
73 | readyList = jQuery.Deferred();
74 |
75 | // Catch cases where $(document).ready() is called after the browser event has already occurred.
76 | // we once tried to use readyState "interactive" here, but it caused issues like the one
77 | // discovered by ChrisS here: http://bugs.jquery.com/ticket/12282#comment:15
78 | if ( document.readyState === "complete" ) {
79 | // Handle it asynchronously to allow scripts the opportunity to delay ready
80 | setTimeout( jQuery.ready );
81 |
82 | } else {
83 |
84 | // Use the handy event callback
85 | document.addEventListener( "DOMContentLoaded", completed, false );
86 |
87 | // A fallback to window.onload, that will always work
88 | window.addEventListener( "load", completed, false );
89 | }
90 | }
91 | return readyList.promise( obj );
92 | };
93 |
94 | // Kick off the DOM ready check even if the user does not
95 | jQuery.ready.promise();
96 |
97 | });
98 |
--------------------------------------------------------------------------------
/vendor/jquery/src/ajax/jsonp.js:
--------------------------------------------------------------------------------
1 | define([
2 | "../core",
3 | "./var/nonce",
4 | "./var/rquery",
5 | "../ajax"
6 | ], function( jQuery, nonce, rquery ) {
7 |
8 | var oldCallbacks = [],
9 | rjsonp = /(=)\?(?=&|$)|\?\?/;
10 |
11 | // Default jsonp settings
12 | jQuery.ajaxSetup({
13 | jsonp: "callback",
14 | jsonpCallback: function() {
15 | var callback = oldCallbacks.pop() || ( jQuery.expando + "_" + ( nonce++ ) );
16 | this[ callback ] = true;
17 | return callback;
18 | }
19 | });
20 |
21 | // Detect, normalize options and install callbacks for jsonp requests
22 | jQuery.ajaxPrefilter( "json jsonp", function( s, originalSettings, jqXHR ) {
23 |
24 | var callbackName, overwritten, responseContainer,
25 | jsonProp = s.jsonp !== false && ( rjsonp.test( s.url ) ?
26 | "url" :
27 | typeof s.data === "string" && !( s.contentType || "" ).indexOf("application/x-www-form-urlencoded") && rjsonp.test( s.data ) && "data"
28 | );
29 |
30 | // Handle iff the expected data type is "jsonp" or we have a parameter to set
31 | if ( jsonProp || s.dataTypes[ 0 ] === "jsonp" ) {
32 |
33 | // Get callback name, remembering preexisting value associated with it
34 | callbackName = s.jsonpCallback = jQuery.isFunction( s.jsonpCallback ) ?
35 | s.jsonpCallback() :
36 | s.jsonpCallback;
37 |
38 | // Insert callback into url or form data
39 | if ( jsonProp ) {
40 | s[ jsonProp ] = s[ jsonProp ].replace( rjsonp, "$1" + callbackName );
41 | } else if ( s.jsonp !== false ) {
42 | s.url += ( rquery.test( s.url ) ? "&" : "?" ) + s.jsonp + "=" + callbackName;
43 | }
44 |
45 | // Use data converter to retrieve json after script execution
46 | s.converters["script json"] = function() {
47 | if ( !responseContainer ) {
48 | jQuery.error( callbackName + " was not called" );
49 | }
50 | return responseContainer[ 0 ];
51 | };
52 |
53 | // force json dataType
54 | s.dataTypes[ 0 ] = "json";
55 |
56 | // Install callback
57 | overwritten = window[ callbackName ];
58 | window[ callbackName ] = function() {
59 | responseContainer = arguments;
60 | };
61 |
62 | // Clean-up function (fires after converters)
63 | jqXHR.always(function() {
64 | // Restore preexisting value
65 | window[ callbackName ] = overwritten;
66 |
67 | // Save back as free
68 | if ( s[ callbackName ] ) {
69 | // make sure that re-using the options doesn't screw things around
70 | s.jsonpCallback = originalSettings.jsonpCallback;
71 |
72 | // save the callback name for future use
73 | oldCallbacks.push( callbackName );
74 | }
75 |
76 | // Call if it was a function and we have a response
77 | if ( responseContainer && jQuery.isFunction( overwritten ) ) {
78 | overwritten( responseContainer[ 0 ] );
79 | }
80 |
81 | responseContainer = overwritten = undefined;
82 | });
83 |
84 | // Delegate to script
85 | return "script";
86 | }
87 | });
88 |
89 | });
90 |
--------------------------------------------------------------------------------
/src/app/channels/manage/create.tpl.html:
--------------------------------------------------------------------------------
1 |
17 |
18 |