diff --git a/CHANGELOG.md b/CHANGELOG.md
index 59ae9166c..dbda6450f 100644
--- a/CHANGELOG.md
+++ b/CHANGELOG.md
@@ -1,5 +1,18 @@
### Changelog
+**0.53.0**
+
+* Navigate away confirmation in 'Unsaved changes' case
+https://github.com/forCrowd/WealthEconomy/issues/60
+ * isEditing property was removed
+ * ResourcePool.isTemp property was removed
+ * dataContext - _createEntitySuppressAuthValidation variable was removed
+ * UPO & Basics CMRPs were moved from client-side to server-side (again)
+* Register - Username and email inputs were disabled for anonymous user case
+* 'Register / login modal is not displayed when a new anonymous user interacts after logout' bug fix
+* Logo update
+* appSettings minor update
+
**0.52.0**
* Send an exception to server in 404 case
diff --git a/DataObjects/Migrations/DbMigrationsConfiguration.cs b/DataObjects/Migrations/DbMigrationsConfiguration.cs
index f98109963..08098e215 100644
--- a/DataObjects/Migrations/DbMigrationsConfiguration.cs
+++ b/DataObjects/Migrations/DbMigrationsConfiguration.cs
@@ -112,6 +112,9 @@ static void CreateSampleUser(WealthEconomyContext context)
// Sample resource pools
var billionDollarQuestion = resourcePoolRepository.CreateBillionDollarQuestion(sampleUser);
+ var upoSample = resourcePoolRepository.CreateUPOSample(sampleUser);
+ var basicsExistingSystemSample = resourcePoolRepository.CreateBasicsExistingSystemSample(sampleUser);
+ var basicsNewSystemSample = resourcePoolRepository.CreateBasicsNewSystemSample(sampleUser);
var priorityIndexSample = resourcePoolRepository.CreatePriorityIndexSample(sampleUser);
var knowledgeIndexSample = resourcePoolRepository.CreateKnowledgeIndexSample(sampleUser);
var knowledgeIndexPopularSoftwareLicenseSample = resourcePoolRepository.CreateKnowledgeIndexPopularSoftwareLicenseSample(sampleUser);
@@ -122,6 +125,9 @@ static void CreateSampleUser(WealthEconomyContext context)
// Set Id fields explicitly, since strangely EF doesn't save them in the order that they've been added to ResourcePoolSet.
// And they're referred with these Ids on front-end samples
billionDollarQuestion.Id = 1;
+ upoSample.Id = 8;
+ basicsExistingSystemSample.Id = 9;
+ basicsNewSystemSample.Id = 10;
priorityIndexSample.Id = 2;
knowledgeIndexSample.Id = 3;
knowledgeIndexPopularSoftwareLicenseSample.Id = 4;
@@ -131,6 +137,9 @@ static void CreateSampleUser(WealthEconomyContext context)
// Insert
resourcePoolRepository.Insert(billionDollarQuestion);
+ resourcePoolRepository.Insert(upoSample);
+ resourcePoolRepository.Insert(basicsExistingSystemSample);
+ resourcePoolRepository.Insert(basicsNewSystemSample);
resourcePoolRepository.Insert(priorityIndexSample);
resourcePoolRepository.Insert(knowledgeIndexSample);
resourcePoolRepository.Insert(knowledgeIndexPopularSoftwareLicenseSample);
diff --git a/DataObjects/ResourcePoolRepository.cs b/DataObjects/ResourcePoolRepository.cs
index 1c1a5845c..875e0e947 100644
--- a/DataObjects/ResourcePoolRepository.cs
+++ b/DataObjects/ResourcePoolRepository.cs
@@ -43,6 +43,99 @@ public ResourcePool CreateBillionDollarQuestion(User user)
return resourcePool;
}
+ public ResourcePool CreateUPOSample(User user)
+ {
+ const int numberOfItems = 1;
+
+ // Resource pool
+ var resourcePool = CreateDefaultResourcePool(user: user,
+ resourcePoolName: "UPO",
+ useFixedResourcePoolRate: true,
+ mainElementName: "Organization",
+ addDirectIncomeField: true,
+ addMultiplierField: true,
+ addImportanceIndex: false,
+ numberOfItems: numberOfItems);
+
+ // Main element
+ var mainElement = resourcePool.ElementSet.First();
+ mainElement.DirectIncomeField.Name = "Sales Price"; // TODO It does not fit! Update this after having Initial Amount on RP!
+ mainElement.MultiplierField.Name = "Number of Sales";
+
+ // Items, cell, user cells
+ // TODO How about ToList()[0]?
+ mainElement.ElementItemSet.First().Name = "UPO";
+
+ // Return
+ return resourcePool;
+ }
+
+ public ResourcePool CreateBasicsExistingSystemSample(User user)
+ {
+ const int numberOfItems = 4;
+
+ // Resource pool
+ var resourcePool = CreateDefaultResourcePool(user: user,
+ resourcePoolName: "Basics - Existing Model",
+ useFixedResourcePoolRate: true,
+ mainElementName: "Organization",
+ addDirectIncomeField: true,
+ addMultiplierField: true,
+ addImportanceIndex: false,
+ numberOfItems: numberOfItems);
+
+ resourcePool.Key = "Basics Existing Model";
+
+ // Main element
+ var mainElement = resourcePool.ElementSet.First();
+ mainElement.DirectIncomeField.Name = "Sales Price";
+ mainElement.MultiplierField.Name = "Number of Sales";
+
+ // Items, cell, user cells
+ mainElement.ElementItemSet.Skip(0).First().Name = "Alpha";
+ mainElement.ElementItemSet.Skip(1).First().Name = "Beta";
+ mainElement.ElementItemSet.Skip(2).First().Name = "Charlie";
+ mainElement.ElementItemSet.Skip(3).First().Name = "Delta";
+
+ // Return
+ return resourcePool;
+ }
+
+ public ResourcePool CreateBasicsNewSystemSample(User user)
+ {
+ const int numberOfItems = 4;
+
+ // Resource pool
+ var resourcePool = CreateDefaultResourcePool(user: user,
+ resourcePoolName: "Basics - New Model",
+ useFixedResourcePoolRate: true,
+ mainElementName: "Organization",
+ addDirectIncomeField: true,
+ addMultiplierField: true,
+ addImportanceIndex: true,
+ numberOfItems: numberOfItems);
+
+ resourcePool.Key = "Basics New Model";
+
+ // Main element
+ var mainElement = resourcePool.ElementSet.First();
+
+ // Fields
+ mainElement.DirectIncomeField.Name = "Sales Price";
+ mainElement.MultiplierField.Name = "Number of Sales";
+
+ mainElement.ElementFieldSet.Single(item => item.IndexEnabled).Name = "Employee Satisfaction";
+
+ // Items, cell, user cells
+ mainElement.ElementItemSet.Skip(0).First().Name = "Alpha";
+ mainElement.ElementItemSet.Skip(1).First().Name = "Beta";
+ mainElement.ElementItemSet.Skip(2).First().Name = "Charlie";
+ mainElement.ElementItemSet.Skip(3).First().Name = "Delta";
+
+ // Return
+ return resourcePool;
+ }
+
public ResourcePool CreatePriorityIndexSample(User user)
{
const int numberOfItems = 4;
diff --git a/Facade/EmailService.cs b/Facade/EmailService.cs
index 18df59c46..e6191da86 100644
--- a/Facade/EmailService.cs
+++ b/Facade/EmailService.cs
@@ -49,8 +49,11 @@ public async Task SendAsync(IdentityMessage message)
case EnvironmentType.Test:
{
// In local & test, always send to notification address
- if (hasNotificationAddress)
- mailMessage.To.Add(new MailAddress(AppSettings.NotificationEmailAddress));
+ if (!hasNotificationAddress)
+ return;
+
+ mailMessage.To.Add(new MailAddress(AppSettings.NotificationEmailAddress));
+
break;
}
case EnvironmentType.Live:
@@ -72,8 +75,10 @@ public async Task SendAsync(IdentityMessage message)
else
{
// Login emails will only be send to notification address
- if (hasNotificationAddress)
- mailMessage.To.Add(new MailAddress(AppSettings.NotificationEmailAddress));
+ if (!hasNotificationAddress)
+ return;
+
+ mailMessage.To.Add(new MailAddress(AppSettings.NotificationEmailAddress));
}
break;
diff --git a/SolutionItems/Documents/Content Notes.txt b/SolutionItems/Documents/Content Notes.txt
index 4c1d4e28f..1024653fc 100644
--- a/SolutionItems/Documents/Content Notes.txt
+++ b/SolutionItems/Documents/Content Notes.txt
@@ -18,6 +18,8 @@ http://www.ted.com/talks/audrey_choi_how_to_make_a_profit_while_making_a_differe
. Review google docs
. Candy crush revenue
. Non profit ironing (and many others) service
+. non profit example - http://john.onolan.org/what-it-means-to-be-non-profit/
+. junk food - http://www.brandsynario.com/12-awesome-junk-foods-their-shocking-calories-count/
# Description
Alt: Measuring the goodness
diff --git a/SolutionItems/Documents/Design.md b/SolutionItems/Documents/Design.md
index 297b68871..ffca07211 100644
--- a/SolutionItems/Documents/Design.md
+++ b/SolutionItems/Documents/Design.md
@@ -1,29 +1,6 @@
-Agbs - Ali Tugrul
-alitugrul@agbs.com.tr
-533 654 3834 http://www.agbsyazilim.com/Home/Index/#intro
+ng2 admin
+http://akveo.com/ng2-admin/
-Uğur Erbaş
-544 6850727
-ugurerbas@outlook.com
+http://foundry.mediumra.re/variant/builder.html
-Şerif Ali Ünal - Kasım's
-553 979 0520
-saunal@gmail.com
-
-Sencer's?
-
----
-1. Çalıştığım projenin websitesinin tasarımı: https://wealth.forcrowd.org
-a. Genel tasarım, menü eklenmesi, iç sayfaların elden geçirilmesi (kullanıcı profili, kayıt olma, kullanıcı girişi vb. sayfalar)
-b. "ResourcePoolEditor": Sayfadaki başlıkların altında bulunan, organizasyon isimlerinin olduğu, kullanıcıların rating girebildiği kısım.
-Bunu daha user- friendly hale getirebilir miyiz vb. Örnek: https://wealth.forcrowd.org/sample/Billion-Dollar-Question
-c. Opsiyonel: Bazı bölümleri grafik ve/veya video ile anlatabilmeyi istiyorum, bu konuda da neler yapabiliriz diye bakabiliriz.
-
-2. Organizasyonun sitesinin tasarımı: http://www.forcrowd.org
-Kimiz, ne yapıyoruz, iletişim vb. bilgilerin bulunacağı ana site.
-Şuna benzer bir çalışma olabilir: http://osfund.co/
-
-3. Logo revizyon: Varolan logoya bir göz atıyor olabiliriz.
-
-. bootstrap
-. Süre, maliyet
+Gitter - ExhibitArts 19:47 If anyone needs a good logo for their non-profit project let me know.
diff --git a/SolutionItems/Documents/General Notes.txt b/SolutionItems/Documents/General Notes.txt
index 8d374f76f..51773334d 100644
--- a/SolutionItems/Documents/General Notes.txt
+++ b/SolutionItems/Documents/General Notes.txt
@@ -1,21 +1,3 @@
-tasarim
-ali tugrul 533 654 3834 http://www.agbsyazilim.com/Home/Index/#intro
-https://bionluk.com/liste/grafik-tasarim | http://foundry.mediumra.re/variant/builder.html
-logo + forcrowd.org + wealth general layout + menu + editor (ratings ui)
-http://osfund.co/
-
-alpha + gitter
-Gitter - ExhibitArts 19:47 If anyone needs a good logo for their non-profit project let me know.
-
-extend globalsign ssl + smarteraspnet static ip
-
----
-upforgrabs - first timer only
-https://github.com/formly-js/angular-formly/blob/master/CONTRIBUTING.md
-https://github.com/blog/1184-contributing-guidelines
-http://up-for-grabs.net/#/
-
----
-git rebase -i HEAD~3
+git rebase -i HEAD~3
git push origin --force
doesnt work with notepad++ ?
diff --git a/SolutionItems/Documents/Social.txt b/SolutionItems/Documents/Social.txt
index 796290c0c..a92c3ad90 100644
--- a/SolutionItems/Documents/Social.txt
+++ b/SolutionItems/Documents/Social.txt
@@ -3,6 +3,7 @@ gitter
personal dev network https://www.facebook.com/lists/10151319136553665
social network - Emin Pamucak
freenode? stackoverflow?
+yourfirstpr (pull request)
hackernews - https://news.ycombinator.com/
reply to twitter
https://twitter.com/sethjuarez/status/692784256670498816
@@ -10,6 +11,31 @@ https://twitter.com/martinwoodward/status/692832558447353857
globalsign makale
https://www.globalsign.com/en/blog/open-source-ssl-pinittome/?utm_source=twitter&utm_medium=social%20media&utm_campaign=blog
https://opensource.com/how-submit-article
+https://opensource.com/participate?sc_cid=701600000011jJVAAY
+https://appear.in/
+
+upforgrabs - first timer only http://up-for-grabs.net/#/
+
+contributing
+https://github.com/formly-js/angular-formly/blob/master/CONTRIBUTING.md
+https://github.com/nayafia/contributing-template/blob/master/CONTRIBUTING-template.md
+https://github.com/blog/1184-contributing-guidelines
+http://www.defmacro.org/2013/04/03/issue-etiquette.html
+https://github.com/mdn/webextensions-examples/commit/ab55344cfca2334c40c89f08b01447f23a8ed467
+
+code of conduct
+http://contributor-covenant.org/
+http://www.ashedryden.com/blog/codes-of-conduct-101-faq
+
+My perfect README contains the following:
+ Project Title
+ Short description of project, including link to Code of Conduct
+ How to install the project
+ Link to tutorials and code examples
+ Frequently asked questions
+ Where to ask questions, i.e file an issue
+ Link to any issues that the project needs help on, like upcoming features.
+ How to get in touch with project maintainers, including more private communication
---
https://www.patreon.com/
@@ -17,6 +43,7 @@ https://gratipay.com/new
https://www.braintreepayments.com/features/marketplace
https://www.citizensbank.com/
live broadcast? younow? haai? https://www.livecoding.tv/
+https://opencollective.com/yeoman
---
grants
@@ -25,6 +52,8 @@ https://wiki.mozilla.org/MOSS
http://www.numfocus.org/
https://www.google.com.tr/search?q=eu+grants+open+source&ie=utf-8&oe=utf-8&gws_rd=cr&ei=f6X2Vt-iK-rB6AS8x7PwBQ
https://stripe.com/blog/open-source-retreat-2016-grantees
+Mozilla Grant https://blog.mozilla.org/blog/2016/05/11/mozilla-open-source-support-moss-now-open-to-all-projects/
+https://jeremy.linuxquestions.org/2016/05/25/are-you-involved-with-an-open-source-project-thats-in-need-of-funding-i-may-be-able-to-help/
---
Hello everyone!
diff --git a/SolutionItems/Documents/Todo.md b/SolutionItems/Documents/Todo.md
index c1665004a..a834b9eef 100644
--- a/SolutionItems/Documents/Todo.md
+++ b/SolutionItems/Documents/Todo.md
@@ -1,15 +1,10 @@
*** HOT ***
-* dataContext.create new cmrp - always check existing ones and don't create duplicate; New-CMRP
-Save failed!
Key 'New-CMRP' already exists Error: Conflict
* field - rating edit in manage.html?
* warmup script for live?!
-* content for forcrowd - story + team
-* content for wealth - articles
* cmrp list? -> search page
* content for editor? new content or new resourcepool - content in a content? or page as a new entity?
* route update (_system/)
-* samples with sample user? (to prevent edit link)
* expand('User' - brings all user info ?!?!?
http://stackoverflow.com/questions/10781309/asp-net-mvc-4-webapi-manually-handle-odata-queries
@@ -30,8 +25,6 @@ still Org1 gets the most?
After Therion
get backup of pubxml files (app.min.js addition to publish) and other files in gitignore + unsynced
gpg keys? https://help.github.com/articles/checking-for-existing-gpg-keys/
-remove forCrowd/breeze.js repository?
-check this item - fix these; basics - new model - update elementcellnumericvalue? - probably this about 'keep displaying login/register modal on each click?'
---
* Busines Rules
@@ -49,8 +42,6 @@ Currently direct income & multiplier field types can only be added once per elem
seems nice, and it could be used in other cases.
however it doesn't return the newly created entity to the caller, which probably is not suitable for most cases?
how about using $injector.get('dataContext') in these cases, instead of broadcast?
- * try to use pure entities, instead of breeze versions? then demo resource pools wouldn't need isTemp?
-resourcePoolFactory.js - // Locally created CMRPs (isTemp) - TODO !
* use createEntity in addX cases!
* // TODO Most of these functions are related with userService.js - updateX functions
// Try to merge these two - Actually try to handle these actions within the related entity / SH - 27 Nov. '15
@@ -141,7 +132,6 @@ With UserAware, should we also mention which actions are allowed?
* ngClient - UI
* my ratings / show all users' ratings should be applied each section separately (cmrp rate, field rating, element cell value)
- * Navigate away confirmation in isEditing
* angular material - https://material.angularjs.org/latest/
* blur admin https://github.com/akveo/blur-admin?utm_content=buffera7574&utm_medium=twitter&utm_source=changelog&utm_campaign=buffer
* Better ratings UI https://angular-ui.github.io/bootstrap/#/getting_started
diff --git a/SolutionItems/Properties/AssemblyInfo.cs b/SolutionItems/Properties/AssemblyInfo.cs
index cd8c71582..111969352 100644
--- a/SolutionItems/Properties/AssemblyInfo.cs
+++ b/SolutionItems/Properties/AssemblyInfo.cs
@@ -30,5 +30,5 @@
//
// AssemblyFileVersion is not in use for the moment
//
-[assembly: AssemblyVersion("0.52.0")]
+[assembly: AssemblyVersion("0.53.0")]
[assembly: AssemblyFileVersion("1.0.0.0")]
diff --git a/WebApi/Configs/Setup/appSettings.config b/WebApi/Configs/Setup/appSettings.config
index e5096beeb..ddc576607 100644
--- a/WebApi/Configs/Setup/appSettings.config
+++ b/WebApi/Configs/Setup/appSettings.config
@@ -11,7 +11,7 @@
-
+
diff --git a/ngClient/_system/css/main.css b/ngClient/_system/css/main.css
index c34df4d5a..bbc3503bd 100644
--- a/ngClient/_system/css/main.css
+++ b/ngClient/_system/css/main.css
@@ -1,4 +1,24 @@
-/* Brand styling - Probably css class names can be better, parent child structure? */
+body {
+ font-size: 15px;
+ padding-top: 50px;
+ padding-bottom: 20px;
+}
+
+/* Set width on the form input elements since they're 100% wide by default */
+input,
+select,
+textarea {
+ max-width: 280px;
+}
+
+.versionText {
+ border-top: 1px solid #333;
+ font-size: 90%;
+ margin-top: 20px;
+ padding: 20px 0;
+}
+
+/* Brand styling - Probably css class names can be better, parent child structure? */
.brandLink,
.brandLink > a,
.brandLink > a:focus,
@@ -28,25 +48,12 @@
font-size: 11px;
}
-body {
- font-size: 15px;
- padding-top: 50px;
- padding-bottom: 20px;
-}
-
/* Set padding to keep content from hitting the edges */
.body-content {
padding-left: 15px;
padding-right: 15px;
}
-/* Set width on the form input elements since they're 100% wide by default */
-input,
-select,
-textarea {
- max-width: 280px;
-}
-
.bg-info {
padding: 15px;
}
diff --git a/ngClient/_system/images/forCrowd_Logo_189x40.jpg b/ngClient/_system/images/forCrowd_Logo_189x40.jpg
new file mode 100644
index 000000000..03ef43e83
Binary files /dev/null and b/ngClient/_system/images/forCrowd_Logo_189x40.jpg differ
diff --git a/ngClient/_system/images/forCrowd_logo_34x34.jpg b/ngClient/_system/images/forCrowd_logo_34x34.jpg
deleted file mode 100644
index 7e8598a8d..000000000
Binary files a/ngClient/_system/images/forCrowd_logo_34x34.jpg and /dev/null differ
diff --git a/ngClient/_system/js/app/config/route.js b/ngClient/_system/js/app/config/route.js
index 678bd6999..e371d9f45 100644
--- a/ngClient/_system/js/app/config/route.js
+++ b/ngClient/_system/js/app/config/route.js
@@ -13,15 +13,15 @@
$routeProvider
/* Content */
- .when('/', { title: 'Home', templateUrl: '/_system/views/content/home.html?v=0.51.0', enableDisqus: true, resolve: { validateAccess: ['dataContext', 'locationHistory', 'logger', '$location', '$q', '$route', validateAccess] } })
- .when('/default.aspx', { title: 'Home', templateUrl: '/_system/views/content/home.html?v=0.51.0', enableDisqus: true, resolve: { validateAccess: ['dataContext', 'locationHistory', 'logger', '$location', '$q', '$route', validateAccess] } })
+ .when('/', { title: 'Home', templateUrl: '/_system/views/content/home.html?v=0.53.0', enableDisqus: true, resolve: { validateAccess: ['dataContext', 'locationHistory', 'logger', '$location', '$q', '$route', validateAccess] } })
+ .when('/default.aspx', { title: 'Home', templateUrl: '/_system/views/content/home.html?v=0.53.0', enableDisqus: true, resolve: { validateAccess: ['dataContext', 'locationHistory', 'logger', '$location', '$q', '$route', validateAccess] } })
// Different than other content pages, enableDisqus: false
.when('/_system/content/notFound', { title: 'Not Found', templateUrl: '/_system/views/content/notFound.html?v=0.52.0', resolve: { validateAccess: ['dataContext', 'locationHistory', 'logger', '$location', '$q', '$route', validateAccess] } })
.when('/_system/content/allInOne', { title: 'All in One', templateUrl: '/_system/views/content/allInOne.html?v=0.49.0', enableDisqus: true, resolve: { validateAccess: ['dataContext', 'locationHistory', 'logger', '$location', '$q', '$route', validateAccess] } })
- .when('/_system/content/basics', { title: 'Basics', templateUrl: '/_system/views/content/basics.html?v=0.51.0', enableDisqus: true, resolve: { validateAccess: ['dataContext', 'locationHistory', 'logger', '$location', '$q', '$route', validateAccess] } })
- .when('/_system/content/home', { title: 'Home', templateUrl: '/_system/views/content/home.html?v=0.51.0', enableDisqus: true, resolve: { validateAccess: ['dataContext', 'locationHistory', 'logger', '$location', '$q', '$route', validateAccess] } })
+ .when('/_system/content/basics', { title: 'Basics', templateUrl: '/_system/views/content/basics.html?v=0.53.0', enableDisqus: true, resolve: { validateAccess: ['dataContext', 'locationHistory', 'logger', '$location', '$q', '$route', validateAccess] } })
+ .when('/_system/content/home', { title: 'Home', templateUrl: '/_system/views/content/home.html?v=0.53.0', enableDisqus: true, resolve: { validateAccess: ['dataContext', 'locationHistory', 'logger', '$location', '$q', '$route', validateAccess] } })
.when('/_system/content/implementation', { title: 'Implementation', templateUrl: '/_system/views/content/implementation.html?v=0.49.0', enableDisqus: true, resolve: { validateAccess: ['dataContext', 'locationHistory', 'logger', '$location', '$q', '$route', validateAccess] } })
- .when('/_system/content/introduction', { title: 'Introduction', templateUrl: '/_system/views/content/introduction.html?v=0.49.0', enableDisqus: true, resolve: { validateAccess: ['dataContext', 'locationHistory', 'logger', '$location', '$q', '$route', validateAccess] } })
+ .when('/_system/content/introduction', { title: 'Introduction', templateUrl: '/_system/views/content/introduction.html?v=0.53.0', enableDisqus: true, resolve: { validateAccess: ['dataContext', 'locationHistory', 'logger', '$location', '$q', '$route', validateAccess] } })
.when('/_system/content/knowledgeIndex', { title: 'Knowledge Index', templateUrl: '/_system/views/content/knowledgeIndex.html?v=0.51.0', enableDisqus: true, resolve: { validateAccess: ['dataContext', 'locationHistory', 'logger', '$location', '$q', '$route', validateAccess] } })
.when('/_system/content/priorityIndex', { title: 'Priority Index', templateUrl: '/_system/views/content/priorityIndex.html?v=0.49.0', enableDisqus: true, resolve: { validateAccess: ['dataContext', 'locationHistory', 'logger', '$location', '$q', '$route', validateAccess] } })
.when('/_system/content/prologue', { title: 'Prologue', templateUrl: '/_system/views/content/prologue.html?v=0.51.0', enableDisqus: true, resolve: { validateAccess: ['dataContext', 'locationHistory', 'logger', '$location', '$q', '$route', validateAccess] } })
@@ -40,13 +40,13 @@
.when('/_system/account/changeUserName', { title: 'Change Username', templateUrl: '/_system/views/account/changeUsername.html?v=0.52.0', accessType: 'authenticatedRequired', resolve: { validateAccess: ['dataContext', 'locationHistory', 'logger', '$location', '$q', '$route', validateAccess] } })
.when('/_system/account/confirmEmail', { title: 'Confirm Email', templateUrl: '/_system/views/account/confirmEmail.html?v=0.51.0', accessType: 'authenticatedRequired', resolve: { validateAccess: ['dataContext', 'locationHistory', 'logger', '$location', '$q', '$route', validateAccess] } })
.when('/_system/account/login', { title: 'Login', templateUrl: '/_system/views/account/login.html?v=0.51.0', accessType: 'unauthenticatedRequired', resolve: { validateAccess: ['dataContext', 'locationHistory', 'logger', '$location', '$q', '$route', validateAccess] } })
- .when('/_system/account/register', { title: 'Register', templateUrl: '/_system/views/account/register.html?v=0.52.0', accessType: 'unauthenticatedRequired', resolve: { validateAccess: ['dataContext', 'locationHistory', 'logger', '$location', '$q', '$route', validateAccess] } })
+ .when('/_system/account/register', { title: 'Register', templateUrl: '/_system/views/account/register.html?v=0.53.0', accessType: 'unauthenticatedRequired', resolve: { validateAccess: ['dataContext', 'locationHistory', 'logger', '$location', '$q', '$route', validateAccess] } })
.when('/_system/account/resetPassword', { title: 'Reset Password', templateUrl: '/_system/views/account/resetPassword.html?v=0.52.0', accessType: 'unauthenticatedRequired', resolve: { validateAccess: ['dataContext', 'locationHistory', 'logger', '$location', '$q', '$route', validateAccess] } })
/* User */
.when('/:userName', { title: 'Profile', templateUrl: '/_system/views/account/profile.html?v=0.51.0', resolve: { validateAccess: ['dataContext', 'locationHistory', 'logger', '$location', '$q', '$route', validateAccess] } })
- .when('/:userName/new', { title: 'New CMRP', templateUrl: '/_system/views/resourcePool/resourcePoolManage.html?v=0.52.0', resolve: { validateAccess: ['dataContext', 'locationHistory', 'logger', '$location', '$q', '$route', validateAccess] } })
- .when('/:userName/:resourcePoolKey/edit', { title: 'Edit CMRP', templateUrl: '/_system/views/resourcePool/resourcePoolManage.html?v=0.52.0', resolve: { validateAccess: ['dataContext', 'locationHistory', 'logger', '$location', '$q', '$route', validateAccess] } })
+ .when('/:userName/new', { title: 'New CMRP', templateUrl: '/_system/views/resourcePool/resourcePoolManage.html?v=0.53.0', resolve: { validateAccess: ['dataContext', 'locationHistory', 'logger', '$location', '$q', '$route', validateAccess] } })
+ .when('/:userName/:resourcePoolKey/edit', { title: 'Edit CMRP', templateUrl: '/_system/views/resourcePool/resourcePoolManage.html?v=0.53.0', resolve: { validateAccess: ['dataContext', 'locationHistory', 'logger', '$location', '$q', '$route', validateAccess] } })
.when('/:userName/:resourcePoolKey', { title: 'View CMRP', templateUrl: '/_system/views/resourcePool/resourcePoolView.html?v=0.49.0', enableDisqus: true, resolve: { validateAccess: ['dataContext', 'locationHistory', 'logger', '$location', '$q', '$route', validateAccess] } })
/* Otherwise */
@@ -104,8 +104,8 @@
// Logger
logger = logger.forSource('routeRun');
- $rootScope.$on('$routeChangeSuccess', routeChangeSuccess);
$rootScope.$on('$routeChangeError', routeChangeError);
+ $rootScope.$on('$routeChangeSuccess', routeChangeSuccess);
// Navigate to correct page in 'Invalid access' cases
function routeChangeError(event, current, previous, eventObj) {
diff --git a/ngClient/_system/js/app/controllers/account/AccountEditController.js b/ngClient/_system/js/app/controllers/account/AccountEditController.js
index 523def6a9..2176f2e2b 100644
--- a/ngClient/_system/js/app/controllers/account/AccountEditController.js
+++ b/ngClient/_system/js/app/controllers/account/AccountEditController.js
@@ -21,14 +21,12 @@
dataContext.getCurrentUser()
.then(function (currentUser) {
vm.currentUser = currentUser;
- vm.currentUser.isEditing = true;
});
/*** Implementations ***/
function cancel() {
vm.currentUser.entityAspect.rejectChanges();
- vm.currentUser.isEditing = false;
$location.url('/_system/account');
}
@@ -40,7 +38,6 @@
function saveChanges() {
isSaving = true;
- vm.currentUser.isEditing = false; // TODO What happens in fail case?
dataContext.saveChanges()
.then(function (result) {
logger.logSuccess('Your changes have been saved!', null, true);
diff --git a/ngClient/_system/js/app/controllers/content/BasicsController.js b/ngClient/_system/js/app/controllers/content/BasicsController.js
index 5f2d14cc8..188b22cc5 100644
--- a/ngClient/_system/js/app/controllers/content/BasicsController.js
+++ b/ngClient/_system/js/app/controllers/content/BasicsController.js
@@ -11,116 +11,16 @@
logger = logger.forSource(controllerId);
var vm = this;
- vm.existingModelConfig = {};
- vm.newModelConfig = {};
+ vm.existingModelConfig = { userName: 'sample', resourcePoolKey: 'Basics-Existing-Model' };
+ vm.newModelConfig = { userName: 'sample', resourcePoolKey: 'Basics-New-Model' };
// Listen resource pool updated event
$scope.$on('resourcePoolEditor_elementMultiplierIncreased', updateOppositeResourcePool);
$scope.$on('resourcePoolEditor_elementMultiplierDecreased', updateOppositeResourcePool);
$scope.$on('resourcePoolEditor_elementMultiplierReset', updateOppositeResourcePool);
- _init();
-
/*** Implementations ***/
- function _init() {
-
- dataContext.getCurrentUser()
- .then(function (currentUser) {
- vm.existingModelConfig = { userName: currentUser.UserName, resourcePoolKey: 'Basics-Existing-Model' };
- vm.newModelConfig = { userName: currentUser.UserName, resourcePoolKey: 'Basics-New-Model' };
-
- resourcePoolFactory.getResourcePoolExpanded(vm.existingModelConfig)
- .then(function (resourcePool) {
- if (resourcePool === null) {
- getBasicsSample()
- .then(function (resourcePool) {
- dataContext.createEntitySuppressAuthValidation(true);
-
- resourcePool.Name = 'Basics - Existing Model';
- resourcePool.Key = vm.existingModelConfig.resourcePoolKey;
- resourcePool.UserResourcePoolSet[0].entityAspect.setDeleted(); // Remove resource pool rate
- resourcePool._init(true);
-
- dataContext.createEntitySuppressAuthValidation(false);
- });
- }
- });
-
- resourcePoolFactory.getResourcePoolExpanded(vm.newModelConfig)
- .then(function (resourcePool) {
- if (resourcePool === null) {
- getBasicsSample()
- .then(function (resourcePool) {
- dataContext.createEntitySuppressAuthValidation(true);
-
- resourcePool.Name = 'Basics - New Model';
- resourcePool.Key = vm.newModelConfig.resourcePoolKey;
-
- // Employee Satisfaction field (index)
- var employeeSatisfactionField = resourcePoolFactory.createElementField({
- Element: resourcePool.mainElement(),
- Name: 'Employee Satisfaction',
- DataType: 4,
- UseFixedValue: false,
- IndexEnabled: true,
- IndexCalculationType: 1,
- IndexSortType: 1,
- SortOrder: 2
- });
-
- employeeSatisfactionField.ElementCellSet.forEach(function (elementCell) {
- var userElementCell = {
- ElementCell: elementCell,
- DecimalValue: Math.floor((Math.random() * 100) + 1)
- };
-
- dataContext.createEntity('UserElementCell', userElementCell);
- });
-
- resourcePool._init(true);
-
- dataContext.createEntitySuppressAuthValidation(false);
- });
- }
- });
- });
- }
-
- function getBasicsSample() {
-
- dataContext.createEntitySuppressAuthValidation(true);
-
- return resourcePoolFactory.createResourcePoolDirectIncomeAndMultiplier()
- .then(function (resourcePool) {
- dataContext.createEntitySuppressAuthValidation(true);
-
- resourcePool.InitialValue = 0;
- resourcePool.isTemp = true;
-
- var mainElement = resourcePool.mainElement();
- mainElement.Name = 'Organization';
-
- mainElement.ElementItemSet[0].Name = 'Alpha';
- mainElement.ElementItemSet[1].Name = 'Beta';
- resourcePoolFactory.createElementItem({
- Element: mainElement,
- Name: 'Charlie'
- });
- resourcePoolFactory.createElementItem({
- Element: mainElement,
- Name: 'Delta'
- });
-
- dataContext.createEntitySuppressAuthValidation(false);
-
- return resourcePool;
- })
- .finally(function () {
- dataContext.createEntitySuppressAuthValidation(false);
- });
- }
-
function updateOppositeResourcePool(event, element) {
var oppositeKey = null;
@@ -135,6 +35,7 @@
if (oppositeKey !== null) {
resourcePoolFactory.getResourcePoolExpanded(oppositeKey)
.then(function (resourcePool) {
+
switch (event.name) {
case 'resourcePoolEditor_elementMultiplierIncreased': {
dataContext.updateElementMultiplier(resourcePool.mainElement(), 'increase');
@@ -149,6 +50,8 @@
break;
}
}
+
+ dataContext.saveChanges(1500);
});
}
}
diff --git a/ngClient/_system/js/app/controllers/content/DefaultController.js b/ngClient/_system/js/app/controllers/content/DefaultController.js
index 8f77fa907..07da51808 100644
--- a/ngClient/_system/js/app/controllers/content/DefaultController.js
+++ b/ngClient/_system/js/app/controllers/content/DefaultController.js
@@ -31,6 +31,7 @@
// Events
$scope.$on('dataContext_currentUserChanged', currentUserChanged);
$scope.$on('unauthenticatedUserInteracted', openRegisterLoginModal);
+ $scope.$on('$locationChangeStart', locationChangeStart);
$scope.$on('$routeChangeSuccess', routeChangeSuccess);
_init();
@@ -51,6 +52,7 @@
function currentUserChanged(event, newUser) {
vm.currentUser = newUser;
+ isRegisterLoginModalOpened = false;
}
function currentUserText() {
@@ -86,7 +88,7 @@
isRegisterLoginModalOpened = true;
var modalInstance = $uibModal.open({
- //backdrop: 'static',
+ backdrop: 'static',
controller: ['$scope', '$uibModalInstance', function ($scope, $uibModalInstance) {
$scope.$on('dataContext_currentUserChanged', closeModal);
$scope.$on('LoginController_redirected', closeModal);
@@ -96,7 +98,7 @@
$uibModalInstance.close();
}
}],
- //keyboard: false,
+ keyboard: false,
size: 'lg',
templateUrl: '/_system/views/account/registerLogin.html?v=0.51.0'
});
@@ -110,6 +112,43 @@
}
}
+ function locationChangeStart(event, newUrl, oldUrl) {
+
+ if (dataContext.hasChanges()) {
+
+ var modalInstance = $uibModal.open({
+ controller: ['$scope', '$uibModalInstance', function ($scope, $uibModalInstance) {
+
+ var vm = this;
+ vm.cancel = cancel;
+ vm.leave = leave;
+
+ function cancel() {
+ $uibModalInstance.dismiss('cancel');
+ }
+
+ function leave() {
+ $uibModalInstance.close();
+ }
+ }],
+ controllerAs: 'vm',
+ templateUrl: '/_system/views/account/confirmNavigateAway.html?v=0.53.0'
+ });
+
+ modalInstance.result.then(function () {
+
+ // User choose to cancel the changes & navigate away
+ dataContext.rejectChanges();
+ $location.path(newUrl.substring($location.absUrl().length - $location.url().length));
+
+ });
+
+ // Always cancel route changes
+ event.preventDefault();
+ return;
+ }
+ }
+
function routeChangeSuccess(event, current, previous) {
// Footer icons
diff --git a/ngClient/_system/js/app/controllers/content/IntroductionController.js b/ngClient/_system/js/app/controllers/content/IntroductionController.js
index 39f49bb8a..2d2a6faf7 100644
--- a/ngClient/_system/js/app/controllers/content/IntroductionController.js
+++ b/ngClient/_system/js/app/controllers/content/IntroductionController.js
@@ -11,79 +11,38 @@
logger = logger.forSource(controllerId);
var vm = this;
- vm.upoConfig = {};
+ vm.upoConfig = { userName: 'sample', resourcePoolKey: 'Unidentified-Profiting-Object' };
- _init();
+ // TODO Disabled for the moment, since it automatically triggers 'anonymous user interacted' / SH - 07 Jun. '16
+ //_init();
/*** Implementations ***/
function _init() {
- dataContext.getCurrentUser()
- .then(function (currentUser) {
+ resourcePoolFactory.getResourcePoolExpanded(vm.upoConfig)
+ .then(function (resourcePool) {
- vm.upoConfig = { userName: currentUser.UserName, resourcePoolKey: 'Unidentified-Profiting-Object' };
+ var increaseMultiplierTimeout = $timeout(increaseMultiplier, 500);
- resourcePoolFactory.getResourcePoolExpanded(vm.upoConfig)
- .then(function (resourcePool) {
- if (resourcePool === null) {
+ function increaseMultiplier() {
- dataContext.createEntitySuppressAuthValidation(true);
-
- resourcePoolFactory.createResourcePoolDirectIncomeAndMultiplier()
- .then(function (resourcePool) {
- dataContext.createEntitySuppressAuthValidation(true);
-
- resourcePool.Name = 'Unidentified Profiting Object (UPO)';
- resourcePool.Key = vm.upoConfig.resourcePoolKey;
- resourcePool.InitialValue = 0;
- resourcePool.isTemp = true;
- resourcePool.displayMultiplierFunctions = false;
- resourcePool.UserResourcePoolSet[0].entityAspect.setDeleted(); // Remove resource pool rate
-
- var mainElement = resourcePool.mainElement();
- mainElement.Name = 'Organization';
-
- mainElement.ElementItemSet[0].Name = 'UPO';
- resourcePoolFactory.removeElementItem(mainElement.ElementItemSet[1]);
-
- resourcePool._init(true);
-
- initResourcePool(resourcePool);
-
- dataContext.createEntitySuppressAuthValidation(false);
- })
- .finally(function () {
- dataContext.createEntitySuppressAuthValidation(false);
- });
- } else {
- initResourcePool(resourcePool);
- }
-
- function initResourcePool(resourcePool) {
-
- var increaseMultiplierTimeout = $timeout(increaseMultiplier, 5000);
-
- function increaseMultiplier() {
-
- // Increase the multiplier
- resourcePool.ElementSet.forEach(function (element) {
- dataContext.updateElementMultiplier(element, 'increase');
- });
-
- // Then increase recursively
- increaseMultiplierTimeout = $timeout(increaseMultiplier, 2500);
- }
-
- // When the DOM element is removed from the page,
- // AngularJS will trigger the $destroy event on
- // the scope. This gives us a chance to cancel any
- // pending timer that we may have.
- $scope.$on("$destroy", function (event) {
- $timeout.cancel(increaseMultiplierTimeout);
- });
- }
+ // Increase the multiplier
+ resourcePool.ElementSet.forEach(function (element) {
+ dataContext.updateElementMultiplier(element, 'increase');
});
+
+ // Then increase recursively
+ increaseMultiplierTimeout = $timeout(increaseMultiplier, 2500);
+ }
+
+ // When the DOM element is removed from the page,
+ // AngularJS will trigger the $destroy event on
+ // the scope. This gives us a chance to cancel any
+ // pending timer that we may have.
+ $scope.$on("$destroy", function (event) {
+ $timeout.cancel(increaseMultiplierTimeout);
+ });
});
}
}
diff --git a/ngClient/_system/js/app/controllers/content/TotalCostIndexController.js b/ngClient/_system/js/app/controllers/content/TotalCostIndexController.js
index a54336c4e..d5b1e7d32 100644
--- a/ngClient/_system/js/app/controllers/content/TotalCostIndexController.js
+++ b/ngClient/_system/js/app/controllers/content/TotalCostIndexController.js
@@ -24,7 +24,7 @@
if (element.ResourcePool.User.UserName === vm.existingModelConfig.userName && element.ResourcePool.Key === vm.existingModelConfig.resourcePoolKey) {
oppositeKey = vm.newModelConfig;
- } else if (element.ResourcePool.User.UserName === vm.existingModelConfig.userName && element.ResourcePool.Key === vm.newModelConfig.resourcePoolKey) {
+ } else if (element.ResourcePool.User.UserName === vm.newModelConfig.userName && element.ResourcePool.Key === vm.newModelConfig.resourcePoolKey) {
oppositeKey = vm.existingModelConfig;
}
diff --git a/ngClient/_system/js/app/controllers/resourcePool/ResourcePoolManageController.js b/ngClient/_system/js/app/controllers/resourcePool/ResourcePoolManageController.js
index 5f31c3f5a..cdebb00c9 100644
--- a/ngClient/_system/js/app/controllers/resourcePool/ResourcePoolManageController.js
+++ b/ngClient/_system/js/app/controllers/resourcePool/ResourcePoolManageController.js
@@ -73,7 +73,6 @@
resourcePoolFactory.createResourcePoolBasic()
.then(function (resourcePool) {
vm.resourcePool = resourcePool;
- vm.resourcePool.isEditing = true;
// Title
// TODO viewTitle was also set in route.js?
@@ -94,7 +93,6 @@
}
vm.resourcePool = resourcePool;
- vm.resourcePool.isEditing = true;
// Title
// TODO viewTitle was also set in route.js?
@@ -210,7 +208,7 @@
function cancelResourcePool() {
- resourcePoolFactory.cancelResourcePool(vm.resourcePool);
+ dataContext.rejectChanges();
dataContext.getCurrentUser()
.then(function (currentUser) {
@@ -322,7 +320,7 @@
var modalInstance = $uibModal.open({
controller: ['$scope', '$uibModalInstance', ResourcePoolRemoveController],
controllerAs: 'vm',
- templateUrl: '/_system/views/resourcePool/resourcePoolRemove.html?v=0.52.0'
+ templateUrl: '/_system/views/resourcePool/resourcePoolRemove.html?v=0.53.0'
});
modalInstance.result.then(function () {
@@ -415,47 +413,6 @@
dataContext.getCurrentUser()
.then(function (currentUser) {
-
- /* Update isEditing state */
- // Resource pool
- vm.resourcePool.isEditing = false;
-
- // User resource pools
- vm.resourcePool.UserResourcePoolSet.forEach(function (userResourcePool) {
- userResourcePool.isEditing = false;
- });
-
- // Elements
- vm.resourcePool.ElementSet.forEach(function (element) {
- element.isEditing = false;
-
- // Fields
- element.ElementFieldSet.forEach(function (elementField) {
- elementField.isEditing = false;
-
- // User element fields
- elementField.UserElementFieldSet.forEach(function (userElementField) {
- userElementField.isEditing = false;
- });
- });
-
- // Items
- element.ElementItemSet.forEach(function (elementItem) {
- elementItem.isEditing = false;
-
- // Cells
- elementItem.ElementCellSet.forEach(function (elementCell) {
- elementCell.isEditing = false;
-
- // User cells
- elementCell.UserElementCellSet.forEach(function (userElementCell) {
- userElementCell.isEditing = false;
- });
- });
- });
- });
- /* Update isEditing state end */
-
dataContext.saveChanges()
.then(function () {
$location.url(vm.resourcePool.urlView());
diff --git a/ngClient/_system/js/app/directives/resourcePoolEditor/resourcePoolEditor.html b/ngClient/_system/js/app/directives/resourcePoolEditor/resourcePoolEditor.html
index 003e011c9..aad55174e 100644
--- a/ngClient/_system/js/app/directives/resourcePoolEditor/resourcePoolEditor.html
+++ b/ngClient/_system/js/app/directives/resourcePoolEditor/resourcePoolEditor.html
@@ -18,7 +18,7 @@
-
+
diff --git a/ngClient/_system/js/app/entities/Element.js b/ngClient/_system/js/app/entities/Element.js
index 29e687743..e388308c0 100644
--- a/ngClient/_system/js/app/entities/Element.js
+++ b/ngClient/_system/js/app/entities/Element.js
@@ -73,7 +73,6 @@
_multiplierField: null,
_totalResourcePoolAmount: null
};
- self.isEditing = false;
// Functions
self.directIncome = directIncome;
diff --git a/ngClient/_system/js/app/entities/ElementCell.js b/ngClient/_system/js/app/entities/ElementCell.js
index 20eb2be8c..e0a49d604 100644
--- a/ngClient/_system/js/app/entities/ElementCell.js
+++ b/ngClient/_system/js/app/entities/ElementCell.js
@@ -45,7 +45,6 @@
_ratingPercentage: null,
_indexIncome: null
};
- self.isEditing = false;
// Functions
self.aggressiveRating = aggressiveRating;
diff --git a/ngClient/_system/js/app/entities/ElementField.js b/ngClient/_system/js/app/entities/ElementField.js
index 25ecfdc47..1c1015dc9 100644
--- a/ngClient/_system/js/app/entities/ElementField.js
+++ b/ngClient/_system/js/app/entities/ElementField.js
@@ -155,7 +155,6 @@
_rating: null,
_indexIncome: null
};
- self.isEditing = false;
// Functions
self.currentUserElementField = currentUserElementField;
diff --git a/ngClient/_system/js/app/entities/ElementItem.js b/ngClient/_system/js/app/entities/ElementItem.js
index b1f1b7186..af0f47f28 100644
--- a/ngClient/_system/js/app/entities/ElementItem.js
+++ b/ngClient/_system/js/app/entities/ElementItem.js
@@ -36,7 +36,6 @@
_totalResourcePoolAmount: null,
_totalResourcePoolIncome: null
};
- self.isEditing = false;
// Functions
self.directIncome = directIncome;
diff --git a/ngClient/_system/js/app/entities/ResourcePool.js b/ngClient/_system/js/app/entities/ResourcePool.js
index 06236e89f..381511a92 100644
--- a/ngClient/_system/js/app/entities/ResourcePool.js
+++ b/ngClient/_system/js/app/entities/ResourcePool.js
@@ -138,8 +138,6 @@
_selectedElement: null,
_useFixedResourcePoolRate: false
};
- self.isEditing = false; // Determines whether the object is being edited or not
- self.isTemp = false; // Determines whether object was created for demo purposes or not
// TODO Move this to field.js?
self.displayMultiplierFunctions = true; // In some cases, it's not necessary for the user to change multiplier
@@ -312,7 +310,6 @@
function name() {
var name = self.Name;
- name += self.isEditing ? ' - Editing' : '';
return name;
}
diff --git a/ngClient/_system/js/app/entities/User.js b/ngClient/_system/js/app/entities/User.js
index caff49462..e28624ba7 100644
--- a/ngClient/_system/js/app/entities/User.js
+++ b/ngClient/_system/js/app/entities/User.js
@@ -43,9 +43,6 @@
//self.Logins = [];
//self.Roles = [];
- // Client-side
- self.isEditing = false;
-
// Functions
self.isAuthenticated = isAuthenticated;
diff --git a/ngClient/_system/js/app/entities/UserElementCell.js b/ngClient/_system/js/app/entities/UserElementCell.js
index 49a3698e7..13e8b0300 100644
--- a/ngClient/_system/js/app/entities/UserElementCell.js
+++ b/ngClient/_system/js/app/entities/UserElementCell.js
@@ -42,7 +42,6 @@
self.backingFields = {
_DecimalValue: null
};
- self.isEditing = false;
}
}
})();
\ No newline at end of file
diff --git a/ngClient/_system/js/app/entities/UserElementField.js b/ngClient/_system/js/app/entities/UserElementField.js
index a38a2d316..dd4c901ea 100644
--- a/ngClient/_system/js/app/entities/UserElementField.js
+++ b/ngClient/_system/js/app/entities/UserElementField.js
@@ -21,9 +21,6 @@
self.UserId = 0;
self.ElementFieldId = 0;
self.Rating = 0;
-
- // Local variables
- self.isEditing = false;
}
}
})();
\ No newline at end of file
diff --git a/ngClient/_system/js/app/entities/UserResourcePool.js b/ngClient/_system/js/app/entities/UserResourcePool.js
index a6e6ac368..f8c834794 100644
--- a/ngClient/_system/js/app/entities/UserResourcePool.js
+++ b/ngClient/_system/js/app/entities/UserResourcePool.js
@@ -21,9 +21,6 @@
self.UserId = 0;
self.ResourcePoolId = 0;
self.ResourcePoolRate = 0;
-
- // Local variables
- self.isEditing = false;
}
}
})();
\ No newline at end of file
diff --git a/ngClient/_system/js/app/factories/dataContext.js b/ngClient/_system/js/app/factories/dataContext.js
index 0bc53d675..1424cbeea 100644
--- a/ngClient/_system/js/app/factories/dataContext.js
+++ b/ngClient/_system/js/app/factories/dataContext.js
@@ -29,13 +29,6 @@
var resetPasswordUrl = serviceAppUrl + '/api/Account/ResetPassword';
var resetPasswordRequestUrl = serviceAppUrl + '/api/Account/ResetPasswordRequest';
var tokenUrl = serviceAppUrl + '/api/Token';
-
- // In create entity function, it checks whether the user is authenticated or not.
- // If not, then broadcasts it, so we can force user to register or login.
- // However, there are some entities that the application has to create for the user (currentUser, sample resourcepools etc.)
- // In those cases, it should stop doing this check, so this flag will be used.
- // SH - 10 Mar. '16
- var _createEntitySuppressAuthValidation = false;
var currentUser = null;
var fetchedUsers = [];
var getCurrentUserPromise = null;
@@ -51,7 +44,6 @@
changeUserName: changeUserName,
confirmEmail: confirmEmail,
createEntity: createEntity,
- createEntitySuppressAuthValidation: createEntitySuppressAuthValidation,
executeQuery: executeQuery,
fetchEntityByKey: fetchEntityByKey,
getChanges: getChanges,
@@ -101,6 +93,8 @@
// Sync RowVersion fields
syncRowVersion(currentUser, updatedUser);
+
+ currentUser.entityAspect.acceptChanges();
})
.error(handleErrorResult);
}
@@ -116,6 +110,8 @@
// Sync RowVersion fields
syncRowVersion(currentUser, updatedUser);
+
+ currentUser.entityAspect.acceptChanges();
})
.error(handleErrorResult);
}
@@ -123,8 +119,11 @@
function changePassword(changePasswordBindingModel) {
return $http.post(changePasswordUrl, changePasswordBindingModel)
.success(function (updatedUser) {
+
// Sync RowVersion fields
syncRowVersion(currentUser, updatedUser);
+
+ currentUser.entityAspect.acceptChanges();
})
.error(handleErrorResult);
}
@@ -142,6 +141,8 @@
// Sync RowVersion fields
syncRowVersion(currentUser, updatedUser);
+
+ currentUser.entityAspect.acceptChanges();
})
.error(handleErrorResult);
}
@@ -154,23 +155,16 @@
// Sync RowVersion fields
syncRowVersion(currentUser, updatedUser);
+
+ currentUser.entityAspect.acceptChanges();
})
.error(handleErrorResult);
}
- function createEntitySuppressAuthValidation(value) {
- _createEntitySuppressAuthValidation = value;
- }
-
function createEntity(entityType, initialValues) {
- // All entities will be created in isEditing state by default
- if (typeof initialValues.isEditing === 'undefined') {
- initialValues.isEditing = true;
- }
-
// Broadcast if unauthorized user creates a new entity (interact with the system)
- if (!_createEntitySuppressAuthValidation && !currentUser.isAuthenticated()) {
+ if (currentUser !== null && !currentUser.isAuthenticated()) {
$rootScope.$broadcast('unauthenticatedUserInteracted');
}
@@ -198,8 +192,7 @@
// Filters
all.forEach(function (change) {
- if (!change.isEditing &&
- (entityTypeName === null || change.entityType.shortName === entityTypeName) &&
+ if ((entityTypeName === null || change.entityType.shortName === entityTypeName) &&
(entityState === null || change.entityAspect.entityState === entityState)) {
changes.push(change);
}
@@ -309,31 +302,20 @@
}
function getAnonymousUser() {
- _createEntitySuppressAuthValidation = true;
var user = createEntity('User', {
Email: getUniqueEmail(),
UserName: getUniqueUserName(),
FirstName: '',
MiddleName: '',
LastName: '',
- IsAnonymous: true,
- isEditing: false
+ IsAnonymous: true
});
- _createEntitySuppressAuthValidation = false;
+ user.entityAspect.acceptChanges();
return user;
}
function getUniqueEmail() {
-
- var now = new Date();
- var year = now.getFullYear();
- var month = now.getMonth() + 1;
- var day = now.getDate();
- var hour = now.getHours();
- var minute = now.getMinutes();
- var second = now.getSeconds();
-
- return 'user_' + year + month + day + '_' + hour + minute + second + '@forcrowd.org';
+ return getUniqueUserName() + '@forcrowd.org';
}
function getUniqueUserName() {
@@ -490,7 +472,8 @@
}
function hasChanges() {
- return manager.hasChanges();
+ return getChanges().length > 0;
+ //return manager.hasChanges();
}
function login(userName, password, rememberMe, singleUseToken) {
@@ -558,7 +541,10 @@
currentUser.IsAnonymous = updatedUser.IsAnonymous;
currentUser.HasPassword = updatedUser.HasPassword;
currentUser.SingleUseToken = updatedUser.SingleUseToken;
- currentUser.RowVersion = updatedUser.RowVersion;
+
+ // Sync RowVersion fields
+ syncRowVersion(currentUser, updatedUser);
+
currentUser.entityAspect.acceptChanges();
getToken(registerBindingModel.UserName, registerBindingModel.Password, rememberMe)
@@ -600,7 +586,10 @@
currentUser.IsAnonymous = updatedUser.IsAnonymous;
currentUser.HasPassword = updatedUser.HasPassword;
currentUser.SingleUseToken = updatedUser.SingleUseToken;
- currentUser.RowVersion = updatedUser.RowVersion;
+
+ // Sync RowVersion fields
+ syncRowVersion(currentUser, updatedUser);
+
currentUser.entityAspect.acceptChanges();
getToken('', '', rememberMe, updatedUser.SingleUseToken)
@@ -638,8 +627,11 @@
function resetPassword(resetPasswordBindingModel) {
return $http.post(resetPasswordUrl, resetPasswordBindingModel)
.success(function (updatedUser) {
+
// Sync RowVersion fields
syncRowVersion(currentUser, updatedUser);
+
+ currentUser.entityAspect.acceptChanges();
})
.error(handleErrorResult);
}
@@ -853,8 +845,7 @@
userCell = createEntity('UserElementCell', {
User: currentUser,
ElementCell: elementCell,
- DecimalValue: updateType === 'increase' ? 1 : 0,
- isEditing: false
+ DecimalValue: updateType === 'increase' ? 1 : 0
});
} else { // If there is an item, update DecimalValue, but cannot be lower than zero
@@ -890,8 +881,7 @@
createEntity('UserElementCell', {
User: currentUser,
ElementCell: elementCell,
- DecimalValue: updateType === 'increase' ? 55 : 45,
- isEditing: false
+ DecimalValue: updateType === 'increase' ? 55 : 45
});
} else { // If there is an item, update DecimalValue, but cannot be smaller than zero and cannot be bigger than 100
@@ -933,8 +923,7 @@
userElementField = {
User: currentUser,
ElementField: elementField,
- Rating: updateType === 'increase' ? 55 : 45,
- isEditing: false
+ Rating: updateType === 'increase' ? 55 : 45
};
createEntity('UserElementField', userElementField);
@@ -1017,8 +1006,7 @@
userResourcePool = {
User: currentUser,
ResourcePool: resourcePool,
- ResourcePoolRate: updateType === 'increase' ? 15 : 5,
- isEditing: false
+ ResourcePoolRate: updateType === 'increase' ? 15 : 5
};
createEntity('UserResourcePool', userResourcePool);
diff --git a/ngClient/_system/js/app/factories/resourcePoolFactory.js b/ngClient/_system/js/app/factories/resourcePoolFactory.js
index 83704764f..a57f93c30 100644
--- a/ngClient/_system/js/app/factories/resourcePoolFactory.js
+++ b/ngClient/_system/js/app/factories/resourcePoolFactory.js
@@ -12,7 +12,6 @@
// Factory methods (alphabetically)
var factory = {
- cancelResourcePool: cancelResourcePool,
copyResourcePool: copyResourcePool,
createElement: createElement,
createElementField: createElementField,
@@ -40,47 +39,6 @@
/*** Implementations ***/
- function cancelResourcePool(resourcePool) {
-
- // Resource pool itself
- resourcePool.entityAspect.rejectChanges();
-
- // User resource pools
- resourcePool.UserResourcePoolSet.forEach(function (userResourcePool) {
- userResourcePool.entityAspect.rejectChanges();
- });
-
- // Elements
- resourcePool.ElementSet.forEach(function (element) {
- element.entityAspect.rejectChanges();
-
- // Fields
- element.ElementFieldSet.forEach(function (elementField) {
- elementField.entityAspect.rejectChanges();
-
- // User element fields
- elementField.UserElementFieldSet.forEach(function (userElementField) {
- userElementField.entityAspect.rejectChanges();
- });
- });
-
- // Items
- element.ElementItemSet.forEach(function (elementItem) {
- elementItem.entityAspect.rejectChanges();
-
- // Cells
- elementItem.ElementCellSet.forEach(function (elementCell) {
- elementCell.entityAspect.rejectChanges();
-
- // User cells
- elementCell.UserElementCellSet.forEach(function (userElementCell) {
- userElementCell.entityAspect.rejectChanges();
- });
- });
- });
- });
- }
-
function copyResourcePool(resourcePoolSource) {
// TODO
}
@@ -308,26 +266,12 @@
.then(function (currentUser) {
var fetchedEarlier = false;
- var fromServer = false;
// If it's not newly created, check the fetched list
fetchedEarlier = fetchedList.some(function (fetched) {
return resourcePoolUniqueKey === fetched;
});
- // Locally created CMRPs (isTemp) - TODO !
- var existing1 = { userName: currentUser.UserName, resourcePoolKey: 'Unidentified-Profiting-Object' };
- var existing2 = { userName: currentUser.UserName, resourcePoolKey: 'Basics-Existing-Model' };
- var existing3 = { userName: currentUser.UserName, resourcePoolKey: 'Basics-New-Model' };
-
- fromServer = !fetchedEarlier &&
- !((resourcePoolUniqueKey.userName === existing1.userName &&
- resourcePoolUniqueKey.resourcePoolKey === existing1.resourcePoolKey) ||
- (resourcePoolUniqueKey.userName === existing2.userName &&
- resourcePoolUniqueKey.resourcePoolKey === existing2.resourcePoolKey) ||
- (resourcePoolUniqueKey.userName === existing3.userName &&
- resourcePoolUniqueKey.resourcePoolKey === existing3.resourcePoolKey));
-
// Prepare the query
var query = breeze.EntityQuery.from('ResourcePool');
@@ -344,7 +288,7 @@
query = query.where(userNamePredicate.and(resourcePoolKeyPredicate));
// From server or local?
- if (fromServer) {
+ if (!fetchedEarlier) {
query = query.using(breeze.FetchStrategy.FromServer);
} else {
query = query.using(breeze.FetchStrategy.FromLocalCache);
@@ -365,7 +309,7 @@
var resourcePool = response.results[0];
// Init
- if (fromServer) {
+ if (!fetchedEarlier) {
resourcePool._init();
}
diff --git a/ngClient/_system/views/account/confirmNavigateAway.html b/ngClient/_system/views/account/confirmNavigateAway.html
new file mode 100644
index 000000000..dc59d9ad1
--- /dev/null
+++ b/ngClient/_system/views/account/confirmNavigateAway.html
@@ -0,0 +1,13 @@
+
+
+
+ You have unsaved changes.
+ Are you sure you want to leave the page?
+
+
+
diff --git a/ngClient/_system/views/account/profile.html b/ngClient/_system/views/account/profile.html
index 6859575b6..e06ede942 100644
--- a/ngClient/_system/views/account/profile.html
+++ b/ngClient/_system/views/account/profile.html
@@ -13,12 +13,12 @@
Created
-
+
Nothing to display
|
-
+
diff --git a/ngClient/_system/views/account/register.html b/ngClient/_system/views/account/register.html
index 57c578ed5..46148b795 100644
--- a/ngClient/_system/views/account/register.html
+++ b/ngClient/_system/views/account/register.html
@@ -22,13 +22,13 @@ Create a new local account
|
-
+
Nothing to display
|
-
+
diff --git a/ngClient/_system/views/resourcePool/resourcePoolRemove.html b/ngClient/_system/views/resourcePool/resourcePoolRemove.html
index b37fcd7dd..78ed7e698 100644
--- a/ngClient/_system/views/resourcePool/resourcePoolRemove.html
+++ b/ngClient/_system/views/resourcePool/resourcePoolRemove.html
@@ -7,6 +7,6 @@ Confirmation
diff --git a/ngClient/default.aspx b/ngClient/default.aspx
index 251c19b4c..88da0436f 100644
--- a/ngClient/default.aspx
+++ b/ngClient/default.aspx
@@ -10,7 +10,7 @@
-
+
@@ -28,7 +28,7 @@
-
-
+
+
@@ -151,7 +146,7 @@
-
+
diff --git a/ngClient/ngClient.csproj b/ngClient/ngClient.csproj
index c6d44741e..fc79438bd 100644
--- a/ngClient/ngClient.csproj
+++ b/ngClient/ngClient.csproj
@@ -43,7 +43,7 @@
-
+
@@ -111,6 +111,7 @@
+
|