Permalink
Browse files

remove all articles, update movies

  • Loading branch information...
1 parent 51c6f4e commit ffc61a5ee6c857ebc8fa76cd50aea0c591c368fe @rrajkowski committed Jul 1, 2014
@@ -1 +0,0 @@
-README: articles
View
@@ -1,51 +0,0 @@
-'use strict';
-
-/*
- * Defining the Package
- */
-var Module = require('meanio').Module;
-
-var Articles = new Module('Articles');
-
-/*
- * All MEAN packages require registration
- * Dependency injection is used to define required modules
- */
-Articles.register(function(app, auth, database) {
-
- //We enable routing. By default the Package Object is passed to the routes
- Articles.routes(app, auth, database);
-
- //We are adding a link to the main menu for all authenticated users
- Articles.menus.add({
- 'roles': ['authenticated'],
- 'title': 'Articles',
- 'link': 'all articles'
- });
- Articles.menus.add({
- 'roles': ['authenticated'],
- 'title': 'Create New Article',
- 'link': 'create article'
- });
-
- /*
- //Uncomment to use. Requires meanio@0.3.7 or above
- // Save settings with callback
- // Use this for saving data from administration pages
- Articles.settings({'someSetting':'some value'},function (err, settings) {
- //you now have the settings object
- });
-
- // Another save settings example this time with no callback
- // This writes over the last settings.
- Articles.settings({'anotherSettings':'some value'});
-
- // Get settings. Retrieves latest saved settigns
- Articles.settings(function (err, settings) {
- //you now have the settings object
- });
- */
- Articles.aggregateAsset('css', 'articles.css');
-
- return Articles;
-});
@@ -1,16 +0,0 @@
-{
- "name": "articles",
- "version": "0.0.1",
- "description": "Articles example pacakge",
- "author": {
- "name": "Linnovate"
- },
- "mean": "0.3.3",
- "engines": {
- "node": "0.10.x",
- "npm": "1.4.x"
- },
- "dependencies": {
- },
- "license": "GPL"
-}
@@ -1,6 +0,0 @@
-h1 {
- text-align: center
-}
-ul.articles li:not(:last-child) {
- border-bottom: 1px solid #ccc
-}
Deleted file not rendered
@@ -1,75 +0,0 @@
-'use strict';
-
-angular.module('mean').controller('ArticlesController', ['$scope', '$stateParams', '$location', 'Global', 'Articles',
- function($scope, $stateParams, $location, Global, Articles) {
- $scope.global = Global;
-
- $scope.hasAuthorization = function(article) {
- if (!article || !article.user) return false;
- return $scope.global.isAdmin || article.user._id === $scope.global.user._id;
- };
-
- $scope.create = function(isValid) {
- if (isValid) {
- var article = new Articles({
- title: this.title,
- content: this.content
- });
- article.$save(function(response) {
- $location.path('articles/' + response._id);
- });
-
- this.title = '';
- this.content = '';
- } else {
- $scope.submitted = true;
- }
- };
-
- $scope.remove = function(article) {
- if (article) {
- article.$remove();
-
- for (var i in $scope.articles) {
- if ($scope.articles[i] === article) {
- $scope.articles.splice(i, 1);
- }
- }
- } else {
- $scope.article.$remove(function(response) {
- $location.path('articles');
- });
- }
- };
-
- $scope.update = function(isValid) {
- if (isValid) {
- var article = $scope.article;
- if (!article.updated) {
- article.updated = [];
- }
- article.updated.push(new Date().getTime());
-
- article.$update(function() {
- $location.path('articles/' + article._id);
- });
- } else {
- $scope.submitted = true;
- }
- };
-
- $scope.find = function() {
- Articles.query(function(articles) {
- $scope.articles = articles;
- });
- };
-
- $scope.findOne = function() {
- Articles.get({
- articleId: $stateParams.articleId
- }, function(article) {
- $scope.article = article;
- });
- };
- }
-]);
@@ -1,57 +0,0 @@
-'use strict';
-
-//Setting up route
-angular.module('mean').config(['$stateProvider',
- function($stateProvider) {
- // Check if the user is connected
- var checkLoggedin = function($q, $timeout, $http, $location) {
- // Initialize a new promise
- var deferred = $q.defer();
-
- // Make an AJAX call to check if the user is logged in
- $http.get('/loggedin').success(function(user) {
- // Authenticated
- if (user !== '0') $timeout(deferred.resolve);
-
- // Not Authenticated
- else {
- $timeout(deferred.reject);
- $location.url('/login');
- }
- });
-
- return deferred.promise;
- };
-
- // states for my app
- $stateProvider
- .state('all articles', {
- url: '/articles',
- templateUrl: 'articles/views/list.html',
- resolve: {
- loggedin: checkLoggedin
- }
- })
- .state('create article', {
- url: '/articles/create',
- templateUrl: 'articles/views/create.html',
- resolve: {
- loggedin: checkLoggedin
- }
- })
- .state('edit article', {
- url: '/articles/:articleId/edit',
- templateUrl: 'articles/views/edit.html',
- resolve: {
- loggedin: checkLoggedin
- }
- })
- .state('article by id', {
- url: '/articles/:articleId',
- templateUrl: 'articles/views/view.html',
- resolve: {
- loggedin: checkLoggedin
- }
- });
- }
-]);
@@ -1,14 +0,0 @@
-'use strict';
-
-//Articles service used for articles REST endpoint
-angular.module('mean').factory('Articles', ['$resource',
- function($resource) {
- return $resource('articles/:articleId', {
- articleId: '@_id'
- }, {
- update: {
- method: 'PUT'
- }
- });
- }
-]);
@@ -1,28 +0,0 @@
-<section data-ng-controller="ArticlesController">
- <form name="articleForm" class="form-horizontal col-md-6" role="form" data-ng-submit="create(articleForm.$valid)" novalidate>
- <div class="form-group" ng-class="{ 'has-error' : submitted && articleForm.title.$invalid }">
- <label mean-token="'create-title'" class="col-md-3 control-label">Title</label>
- <div class="col-md-9">
- <input name="title" type="text" class="form-control" data-ng-model="title" id="title" placeholder="Title" required>
- <div ng-show="submitted && articleForm.title.$invalid" class="help-block">
- <p ng-show="articleForm.title.$error.required">Title is required</p>
- </div>
- </div>
-
- </div>
- <div class="form-group" ng-class="{ 'has-error' : submitted && articleForm.content.$invalid }">
- <label mean-token="'create-content'" for="content" class="col-md-3 control-label">Content</label>
- <div class="col-md-9">
- <textarea name="content" data-ng-model="content" id="content" cols="30" rows="10" placeholder="Content" class="form-control" required></textarea>
- <div ng-show="submitted && articleForm.content.$invalid" class="help-block">
- <p ng-show="articleForm.content.$error.required">Content is required</p>
- </div>
- </div>
- </div>
- <div class="form-group">
- <div class="col-md-offset-3 col-md-9">
- <button type="submit" class="btn btn-info">Submit</button>
- </div>
- </div>
- </form>
-</section>
@@ -1,28 +0,0 @@
-<section data-ng-controller="ArticlesController" data-ng-init="findOne()">
- <form name="articleForm" class="form-horizontal col-md-6" role="form" data-ng-submit="update(articleForm.$valid)" novalidate>
- <div class="form-group" ng-class="{ 'has-error' : submitted && articleForm.title.$invalid }">
- <label mean-token="'edit-title'" for="title" class="col-md-2 control-label">Title</label>
- <div class="col-md-10">
- <input name="title" type="text" class="form-control" data-ng-model="article.title" id="title" placeholder="Title" required>
- <div ng-show="submitted && articleForm.title.$invalid" class="help-block">
- <p ng-show="articleForm.title.$error.required">Title is required</p>
- </div>
- </div>
-
- </div>
- <div class="form-group" ng-class="{ 'has-error' : submitted && articleForm.content.$invalid }">
- <label mean-token="'edit-content'" for="content" class="col-md-2 control-label">Content</label>
- <div class="col-md-10">
- <textarea name="content" data-ng-model="article.content" id="content" cols="30" rows="10" placeholder="Content" class="form-control" required></textarea>
- <div ng-show="submitted && articleForm.content.$invalid" class="help-block">
- <p ng-show="articleForm.content.$error.required">Content is required</p>
- </div>
- </div>
- </div>
- <div class="form-group">
- <div class="col-md-offset-2 col-md-10">
- <button mean-token="'edit-submit'" type="submit" class="btn btn-default">Submit</button>
- </div>
- </div>
- </form>
-</section>
@@ -1,21 +0,0 @@
-<section data-ng-controller="ArticlesController" data-ng-init="find()">
- <ul class="articles unstyled">
- <li data-ng-repeat="article in articles">
- <span>{{article.created | date:'medium'}}</span> /
- <span>{{article.user.name}}</span>
- <h2>
- <a data-ng-href="#!/articles/{{article._id}}">{{article.title}}</a>
- <span data-ng-if="hasAuthorization(article)">
- <a class="btn" href="/#!/articles/{{article._id}}/edit">
- <i class="glyphicon glyphicon-edit"></i>
- </a>
- <a class="btn" data-ng-click="remove(article);">
- <i class="glyphicon glyphicon-trash"></i>
- </a>
- </span>
- </h2>
- <div>{{article.content}}</div>
- </li>
- </ul>
- <h1 data-ng-hide="!articles || articles.length">No articles yet. <br> Why don't you <a href="/#!/articles/create">Create One</a>?</h1>
-</section>
@@ -1,14 +0,0 @@
-<section data-ng-controller="ArticlesController" data-ng-init="findOne()">
- <span>{{article.created | date:'medium'}}</span> /
- <span>{{article.user.name}}</span>
- <h2>{{article.title}}</h2>
- <div data-ng-if="hasAuthorization(article)">
- <a class="btn" href="/#!/articles/{{article._id}}/edit">
- <i class="glyphicon glyphicon-edit"></i>
- </a>
- <a class="btn" data-ng-click="remove(article);">
- <i class="glyphicon glyphicon-trash"></i>
- </a>
- </div>
- <div>{{article.content}}</div>
-</section>
Oops, something went wrong.

0 comments on commit ffc61a5

Please sign in to comment.