Skip to content

Commit

Permalink
Merged PR 12650: Initial implementation
Browse files Browse the repository at this point in the history
  • Loading branch information
joris-peters committed May 22, 2024
1 parent bac9a29 commit 7a45460
Show file tree
Hide file tree
Showing 21 changed files with 105 additions and 768 deletions.
10 changes: 5 additions & 5 deletions GitVersion.yml
Original file line number Diff line number Diff line change
Expand Up @@ -3,22 +3,22 @@ next-version: 1.0.0
branches:
feature:
tag: alpha
regex: ^v8/feature/
regex: ^v7/feature/
source-branches: ['develop']
is-mainline: false
develop:
tag: beta
regex: ^v8/develop$
regex: ^v7/develop$
source-branches: []
is-mainline: false
master:
tag: ''
regex: ^v8/main$
regex: ^v7/main$
is-mainline: true
hotfix:
tag: 'beta'
regex: ^v8/hotfix
source-branches: ['master']
regex: ^v7/hotfix
source-branches: ['main']
is-mainline: false
ignore:
sha: []
Binary file removed Icomoon_icon_picker_1.0.0.zip
Binary file not shown.
1 change: 0 additions & 1 deletion Nuget.config
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,5 @@
<configuration>
<packageSources>
<add key="nuget.org" value="https://api.nuget.org/v3/index.json" protocolVersion="3" />
<add key="Infocaster" value="http://nexus.infocaster.net/repository/infocaster-nuget/" />
</packageSources>
</configuration>
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
# Icomoon Icon Picker
This package lets you use your icomoon project as an icon picker for the specified doctype for Umbraco 8
This package lets you use your icomoon project as an icon picker for the specified doctype for Umbraco 7

# Getting Started

Expand Down
Binary file removed UmbracoAwesome-IcomoonPicker.1.0.0.nupkg
Binary file not shown.
8 changes: 4 additions & 4 deletions UmbracoAwesomeIcomoonPicker.nuspec
Original file line number Diff line number Diff line change
Expand Up @@ -2,21 +2,21 @@
<package xmlns="http://schemas.microsoft.com/packaging/2011/10/nuspec.xsd">
<metadata>
<id>UmbracoAwesome-IcomoonPicker</id>
<version>1.0.0</version>
<version>7.0.0</version>
<authors>Infocaster</authors>
<owners>Infocaster</owners>
<projectUrl>https://infocaster.net/</projectUrl>
<requireLicenseAcceptance>false</requireLicenseAcceptance>
<description>This will add a property editor type to your data types section.</description>
<releaseNotes><![CDATA[1.0.0 Initial release]]></releaseNotes>
<copyright>Copyright 2021</copyright>
<releaseNotes><![CDATA[7.0.0 Initial release]]></releaseNotes>
<copyright>Copyright 2024</copyright>
<tags>umbraco, umbraco-cms, umbracoAwesome, Icomoon</tags>
<dependencies>

</dependencies>
</metadata>
<files>
<file src="src\Infocaster.UmbracoAwesome.Icomoon\App_Plugins\Icomoon\**\*.*" target="content\App_Plugins\Icomoon" />
<file src="src\Infocaster.UmbracoAwesome.Icomoon\bin\Release\Infocaster.Icomoon.dll" target="lib" />
<file src="src\Infocaster.UmbracoAwesome.Icomoon\bin\Release\netstandard2.0\Infocaster.Umbraco.IcomoonPicker.dll" target="lib" />
</files>
</package>
10 changes: 5 additions & 5 deletions azure-pipelines.yml
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
trigger:
branches:
include:
- v8/main
- v8/develop
- v8/release/*
- v8/hotfix
- v7/main
- v7/develop
- v7/release/*
- v7/hotfix
tags:
include:
- 1.*
Expand Down Expand Up @@ -68,7 +68,7 @@ stages:
- stage: release
displayName: Release
dependsOn: build
condition: and(succeeded(), or(startsWith(variables['Build.SourceBranch'], 'refs/tags/'), in(variables['build.sourcebranch'], 'refs/heads/v8/develop')))
condition: and(succeeded(), or(startsWith(variables['Build.SourceBranch'], 'refs/tags/'), in(variables['build.sourcebranch'], 'refs/heads/v7/develop')))
jobs:
- job: release
displayName: Push to artifacts
Expand Down
12 changes: 6 additions & 6 deletions icomoon.sln
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,6 @@ Microsoft Visual Studio Solution File, Format Version 12.00
# Visual Studio Version 17
VisualStudioVersion = 17.1.32228.430
MinimumVisualStudioVersion = 10.0.40219.1
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "icomoon", "src\Infocaster.UmbracoAwesome.Icomoon\icomoon.csproj", "{D195BB9E-952C-4980-9D26-35CC5F0E7D17}"
EndProject
Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "Solution Items", "Solution Items", "{8414108E-9037-4219-A8DF-E928227BC76D}"
ProjectSection(SolutionItems) = preProject
azure-pipelines.yml = azure-pipelines.yml
Expand All @@ -14,16 +12,18 @@ Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "Solution Items", "Solution
UmbracoAwesomeIcomoonPicker.nuspec = UmbracoAwesomeIcomoonPicker.nuspec
EndProjectSection
EndProject
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Infocaster.Umbraco.IcomoonPicker", "src\Infocaster.UmbracoAwesome.Icomoon\Infocaster.Umbraco.IcomoonPicker.csproj", "{7A522539-D746-410B-8F4D-1A717B672E9A}"
EndProject
Global
GlobalSection(SolutionConfigurationPlatforms) = preSolution
Debug|Any CPU = Debug|Any CPU
Release|Any CPU = Release|Any CPU
EndGlobalSection
GlobalSection(ProjectConfigurationPlatforms) = postSolution
{D195BB9E-952C-4980-9D26-35CC5F0E7D17}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{D195BB9E-952C-4980-9D26-35CC5F0E7D17}.Debug|Any CPU.Build.0 = Debug|Any CPU
{D195BB9E-952C-4980-9D26-35CC5F0E7D17}.Release|Any CPU.ActiveCfg = Release|Any CPU
{D195BB9E-952C-4980-9D26-35CC5F0E7D17}.Release|Any CPU.Build.0 = Release|Any CPU
{7A522539-D746-410B-8F4D-1A717B672E9A}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{7A522539-D746-410B-8F4D-1A717B672E9A}.Debug|Any CPU.Build.0 = Debug|Any CPU
{7A522539-D746-410B-8F4D-1A717B672E9A}.Release|Any CPU.ActiveCfg = Release|Any CPU
{7A522539-D746-410B-8F4D-1A717B672E9A}.Release|Any CPU.Build.0 = Release|Any CPU
EndGlobalSection
GlobalSection(SolutionProperties) = preSolution
HideSolutionNode = FALSE
Expand Down
Original file line number Diff line number Diff line change
@@ -1,50 +1,43 @@
(function () {

angular.module('umbraco')
.controller('infocaster.icomooneditorcontroller', ['editorService', 'assetsService', '$http', '$scope', icomoonEditorController]);
.controller('infocaster.icomooneditorcontroller', ['dialogService', 'assetsService', '$http', '$scope', icomoonEditorController]);

function icomoonEditorController(editorService, assetsService, $http, $scope) {
function icomoonEditorController(dialogService, assetsService, $http, $scope) {

const $this = this;
$this.edit = edit;

function edit() {

const options = {
title: 'Select icon from icomoon',
view: '/app_plugins/Icomoon/views/panel.html',
size: 'small',
submit: submit,
close: close,
value: $scope.model.value
template: '/app_plugins/Icomoon/views/panel.html',
callback: submit
}

editorService.open(options);
dialogService.open(options);
}

function submit(value) {

$scope.model.value = value;
close();
}

function close() {

editorService.close();
dialogService.close();
}

function init() {

assetsService.loadJs(`https://i.icomoon.io/public/${$scope.model.config.projectCode}/${$scope.model.config.projectName}/svgxuse.js`);

if (typeof $scope.model.value !== 'string') {

$scope.model.value = '';
}

const svg = document.querySelector('body>svg');
if (!svg) {

if (!svg) {
$http.get(`/umbraco/backoffice/icomoon/files/svg?code=${$scope.model.config.projectCode}&project=${$scope.model.config.projectName}`)
.then(function (data) {
const element = document.createElement("div");
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,27 +5,19 @@

function icomoonPanelController($scope) {

const $this = this;
$this.close = close;
$this.select = select;
$this.icons = [];
$scope.loading = true;
$scope.icons = [];

function close() {

$scope.model.close();
}

function select(icon) {

$scope.model.submit(icon);
}
$scope.submitClass = function (icon) {
$scope.submit(icon);
};

function init() {

var iconElement = document.body.firstChild;
iconElement.querySelectorAll("symbol").forEach(function (s) {
$this.icons.push(s.id);
})
$scope.icons.push(s.id);
});
$scope.loading = false;
}

init();
Expand Down
Original file line number Diff line number Diff line change
@@ -1,37 +1,27 @@
<div ng-controller="infocaster.icomoonpanelcontroller as vm">
<ng-form val-form-manager>
<umb-editor-view>
<umb-editor-header name="model.title"
name-locked="true"
hide-alias="true"
hide-icon="true"
hide-description="true">
</umb-editor-header>

<umb-editor-container>
<umb-box>
<umb-box-content>
<ul class="umb-iconpicker color-black">
<li class="umb-iconpicker-item icomoon-list" ng-repeat="icon in vm.icons">
<svg class="umb-icon icomoon-icon" ng-class="icon" ng-click="vm.select(icon)">
<use ng-attr-href="#{{icon}}"></use>
</svg>
</li>
</ul>
</umb-box-content>
</umb-box>
</umb-editor-container>

<umb-editor-footer>
<umb-editor-footer-content-right>
<umb-button type="button"
button-style="link"
label-key="general_close"
shortcut="esc"
action="vm.close()">
</umb-button>
</umb-editor-footer-content-right>
</umb-editor-footer>
</umb-editor-view>
</ng-form>
<div class="umb-panel-body with-footer">
<umb-load-indicator ng-if="loading"></umb-load-indicator>
<div class="umb-control-group" ng-show="!loading">
<ul class="umb-iconpicker" ng-class="color" ng-show="icons">
<li class="umb-iconpicker-item icomoon-list" ng-repeat="icon in icons">
<svg class="umb-icon icomoon-icon" ng-class="icon" ng-click="submitClass(icon)">
<use ng-attr-href="#{{icon}}"></use>
</svg>
</li>
</ul>
</div>
<umb-empty-state ng-if="icons.length === 0"
position="center">
<localize key="defaultdialogs_noIconsFound">No icons were found.</localize>
</umb-empty-state>
</div>
<div class="umb-panel-footer">
<div class="umb-el-wrap umb-panel-buttons">
<div class="btn-toolbar umb-btn-toolbar pull-right">
<a href ng-click="close()" class="btn btn-link">
<localize key="general_cancel">Cancel</localize>
</a>
</div>
</div>
</div>
</div>
Original file line number Diff line number Diff line change
@@ -1,4 +1,6 @@
using System.Net.Http;
using System.Net;
using System.Net.Http;
using System.Net.Http.Headers;
using System.Threading.Tasks;
using System.Web.Http;
using Umbraco.Web.Mvc;
Expand All @@ -12,12 +14,15 @@ public class FilesController : UmbracoAuthorizedApiController
private static readonly HttpClient _client = new HttpClient();

[HttpGet]
public async Task<IHttpActionResult> Svg([FromUri] string code, [FromUri] string project)
public async Task<HttpResponseMessage> Svg(string code, string project)
{
var result = await _client.GetAsync($"https://i.icomoon.io/public/{code}/{project}/symbol-defs.svg");
result.EnsureSuccessStatusCode();

return Ok(await result.Content.ReadAsStringAsync());
var content = await result.Content.ReadAsStringAsync();
var response = Request.CreateResponse(HttpStatusCode.OK);
response.Content = new StringContent(content);
response.Content.Headers.ContentType = new MediaTypeHeaderValue("image/svg+xml");
return response;
}
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
<Project Sdk="Microsoft.NET.Sdk">
<PropertyGroup>
<TargetFramework>netstandard2.0</TargetFramework>
</PropertyGroup>
<ItemGroup>
<Content Include="App_plugins\Icomoon\package.manifest" />
<Content Include="App_plugins\Icomoon\scripts\editor.controller.js" />
<Content Include="App_plugins\Icomoon\scripts\panel.controller.js" />
<Content Include="App_plugins\Icomoon\style\icomoon.css" />
<Content Include="App_plugins\Icomoon\views\editor.html" />
<Content Include="App_plugins\Icomoon\views\panel.html" />
</ItemGroup>
<ItemGroup>
<PackageReference Include="UmbracoCms.Core" Version="7.15.0" />
</ItemGroup>
</Project>
35 changes: 0 additions & 35 deletions src/Infocaster.UmbracoAwesome.Icomoon/Properties/AssemblyInfo.cs

This file was deleted.

Loading

0 comments on commit 7a45460

Please sign in to comment.