Skip to content

Commit

Permalink
Build release 0.9.0
Browse files Browse the repository at this point in the history
  • Loading branch information
janvanhelvoort committed May 22, 2018
2 parents 936cbf1 + 6f7b06b commit 3fbd8a8
Show file tree
Hide file tree
Showing 8 changed files with 81 additions and 7 deletions.
Original file line number Diff line number Diff line change
@@ -1,6 +1,8 @@
function ContentController($scope, $routeParams, angularHelper) {
$scope.answerInput = { value: '', hasError: false };

$scope.amountOfAnswers = Umbraco.Sys.ServerVariables.pollIt.AmountOfAnswers;

$scope.sortableOptions = {
axis: 'y',
containment: 'parent',
Expand Down Expand Up @@ -38,13 +40,13 @@
$scope.endDatePicker = { view: 'datepicker', value: $scope.model.question.endDate, config: $.extend({}, $scope.config.datePicker) };

$scope.$watch('startDatePicker', function () {
if ($scope.startDatePicker != undefined) {
if (typeof $scope.startDatePicker !== 'undefined') {
$scope.model.question.startDate = $scope.startDatePicker.value;
}
}, true);

$scope.$watch('endDatePicker', function () {
if ($scope.endDatePicker != undefined) {
if (typeof $scope.endDatePicker !== 'undefined') {
$scope.model.question.endDate = $scope.endDatePicker.value;
}
}, true);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
<umb-control-group label="@pollIt_addAnswer" description="@pollIt_addAnswerDescription">
<div class="control-group">
<input name="newItem" type="text" ng-model="answerInput.value" val-highlight="{{answerInput.hasError}}" />
<button class="btn" ng-click="addAnswer($event)" ng-disabled="model.answers.length > 6 || !answerInput.value">
<button class="btn" ng-click="addAnswer($event)" ng-disabled="model.question.answers.length >= amountOfAnswers || !answerInput.value">
<localize key="general_add">Add</localize>
</button>
</div>
Expand Down
10 changes: 10 additions & 0 deletions Source/Qvision.Umbraco.PollIt/Constants/AppSettings.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
namespace Qvision.PollIt.Constants
{
internal class AppSettings
{
/// <summary>
/// Amount of answers per question
/// </summary>
public const string AmountOfAnswers = "pollIt:AmountOfAnswers";
}
}
57 changes: 57 additions & 0 deletions Source/Qvision.Umbraco.PollIt/PollItContext.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,57 @@
namespace Qvision.PollIt
{
using System.Configuration;

using Umbraco.Core;

/// <summary>
/// The Poll-it Context
/// </summary>
public class PollItContext
{
/// <summary>
/// The current instance.
/// </summary>
private static PollItContext instance;

/// <summary>
/// Prevents a default instance of the <see cref="PollItContext"/> class from being created.
/// </summary>
private PollItContext()
{
this.AmountOfAnswers = this.GetAppSetting<int>(Constants.AppSettings.AmountOfAnswers, 6);
instance = this;
}

/// <summary>
/// Gets the current context
/// </summary>
public static PollItContext Current => instance ?? new PollItContext();

// Amount of answers
public int AmountOfAnswers { get; set; }

/// <summary>
/// Gets the value of app setting
/// </summary>
/// <param name="key">The key.</param>
/// <typeparam name="T">The return type</typeparam>
/// <returns>The <see cref="T"/>.</returns>
private T GetAppSetting<T>(string key, T defaultValue)
{
var setting = ConfigurationManager.AppSettings[key];

if (setting != null)
{
var attempConvert = setting.TryConvertTo<T>();

if (attempConvert.Success)
{
return attempConvert.Result;
}
}

return defaultValue;
}
}
}
4 changes: 2 additions & 2 deletions Source/Qvision.Umbraco.PollIt/Properties/AssemblyInfo.cs
Original file line number Diff line number Diff line change
Expand Up @@ -32,5 +32,5 @@
// You can specify all the values or you can default the Build and Revision Numbers
// by using the '*' as shown below:
// [assembly: AssemblyVersion("1.0.*")]
[assembly: AssemblyVersion("0.8.1.*")]
[assembly: AssemblyFileVersion("0.8.1.*")]
[assembly: AssemblyVersion("0.9.0.*")]
[assembly: AssemblyFileVersion("0.9.0.*")]
3 changes: 3 additions & 0 deletions Source/Qvision.Umbraco.PollIt/Qvision.Umbraco.PollIt.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -177,6 +177,7 @@
</Reference>
<Reference Include="System" />
<Reference Include="System.ComponentModel.DataAnnotations" />
<Reference Include="System.Configuration" />
<Reference Include="System.Core" />
<Reference Include="System.Data.SqlServerCe, Version=4.0.0.1, Culture=neutral, PublicKeyToken=89845dcd8080cc91, processorArchitecture=MSIL">
<HintPath>..\packages\UmbracoCms.Core.7.6.3\lib\net45\System.Data.SqlServerCe.dll</HintPath>
Expand Down Expand Up @@ -275,6 +276,7 @@
<Compile Include="Attributes\CamelCaseAttribute.cs" />
<Compile Include="CacheRefresher\PollItCacheRefresher.cs" />
<Compile Include="Constants\ApplicationConstants.cs" />
<Compile Include="Constants\AppSettings.cs" />
<Compile Include="Constants\CacheRefresherConstants.cs" />
<Compile Include="Constants\RuntimeCacheConstants.cs" />
<Compile Include="Constants\TableConstants.cs" />
Expand All @@ -297,6 +299,7 @@
<Compile Include="Models\Repositories\QuestionRepository.cs" />
<Compile Include="Models\Repositories\ResponseRepository.cs" />
<Compile Include="Models\Response.cs" />
<Compile Include="PollItContext.cs" />
<Compile Include="Properties\VersionInfo.cs" />
<Compile Include="Services\PollItService.cs" />
<Compile Include="Startup.cs" />
Expand Down
4 changes: 3 additions & 1 deletion Source/Qvision.Umbraco.PollIt/Startup.cs
Original file line number Diff line number Diff line change
Expand Up @@ -136,7 +136,9 @@ private void ServerVariablesParserParsing(object sender, Dictionary<string, obje
{ "getQuestionResponsesById", urlHelper.GetUmbracoApiService<QuestionApiController>("GetResponses") },

{ "saveAnswer", urlHelper.GetUmbracoApiService<AnswerApiController>("Post") },
{ "deleteAnswer", urlHelper.GetUmbracoApiService<AnswerApiController>("Delete") }
{ "deleteAnswer", urlHelper.GetUmbracoApiService<AnswerApiController>("Delete") },

{ "AmountOfAnswers", PollItContext.Current.AmountOfAnswers }
};

e.Add("pollIt", urlDictionairy);
Expand Down
2 changes: 1 addition & 1 deletion appveyor.yml
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
os: Visual Studio 2015

# Version format
version: 0.8.1.{build}
version: 0.9.0.{build}

cache:
- Source\packages -> **\packages.config # preserve "packages" directory in the root of build folder but will reset it if packages.config is modified
Expand Down

0 comments on commit 3fbd8a8

Please sign in to comment.