Quantcast
Channel: ActiveTopics
Viewing all 72689 articles
Browse latest View live

AngularJS two-way binding seems not to work for me..

$
0
0

Hello!

I'm creating a custom section in Umkbraco Backoffice and trying to create a CRUD page using AngularJS. The aim is to have a table populated from a database. When the user click the edit button, the form is filled with the data from the corresponding line, after modifying anything, the data should be updated in the DB. Also i have a cancel button which clears the form. Using the form i want to implement simple add mechanism as well.

The page looks like this: enter image description here

I'm able to fill the table, and also able to fill the form with the data of the selected row.

The strange behaviour is when i fill the form, modifying anything on a textbox (even a character delete), and trying to edit another row, every textbox loads the value of the newly selected row, expect the textbox which has the modification previously. And no matter how many times i try to load a row's data into the form, that specific textbox remains the same, not refreshing any data.

Another problem if i try to save the modifications i'm not able to read the current value of the textbox. Angular keeps wrining to DB the same value as was read from the db. - it looks like the view is not synchronizing with the model.

the html file:

<div ng-controller="tnsConfig.items.EditController">

    <umb-editor-view>

        <umb-editor-container>
            <h2>Search config</h2>
            <p>The below list shows the items which then will be displayed in the header search box as content type filter categories. <br />Connections can be created between Document types and Dictionary items in order to make translation possible. </p>
            <br /><br />
                  <form ng-submit="abc()">
                    <div class="umb-pane">
                        <umb-control-group label="Name" description="Name to identify the item">
                            <input type="text" class="umb-editor umb-textstring" ng-model="id" ng-hide="true" />
                            <input type="text" class="umb-editor umb-textstring" ng-model="name" required />
                        </umb-control-group>

                        <umb-control-group label="DocumentType Alias" description="The document type the filter represents">
                            <input type="text" class="umb-editor umb-textstring" ng-model="doctype" required />
                        </umb-control-group>

                        <umb-control-group label="Dictionary Item" description="Filter text appear in the search dropdown">
                            <input type="text" class="umb-editor umb-textstring" ng-model="dictionary" required />
                        </umb-control-group>

                        <div class="umb-tab-buttons" detect-fold>
                            <div class="btn-group">
                                <button type="submit" data-hotkey="ctrl+s" class="btn btn-success">
                                    <localize key="buttons_save">Save</localize>
                                </button>

                            </div>
                            <div class="btn-group">
                                <button type="reset" ng-click="cancelEdit()" class="btn btn-warning">
                                    Cancel
                                </button>
                            </div>
                        </div>

                    </div>
                  </form>

            <table id="mytable" class="table table-bordred table-striped">
                <thead>
                    <tr>
                        <td>Name</td>
                        <td>DocumentType Alias</td>
                        <td>DictionaryItem</td>
                        <td></td>
                        <td>
                            <div class="my-action" style=" width:90%;">
                                <umb-confirm-action ng-if="promptIsVisible"
                                                    direction="up"
                                                    on-confirm="confirmAction()"
                                                    on-cancel="hidePrompt()">

                                </umb-confirm-action>
                            </div>
                        </td>
                    </tr>
                </thead>
                <tbody>
                    <tr ng-repeat="item in items">
                        <td>{{item.name}}</td>
                        <td>{{item.documentTypeAlias}}</td>
                        <td>{{item.dictionaryItem}}</td>

                        <td>
                            <a class="btn btn-primary btn-xs" ng-click="loadItemToEdit(item.id)">Edit</a>
                        </td>
                        <td><i class="icon-trash" ng-click="showPrompt(item.id)"></i></td>
                    </tr>
                </tbody>
            </table>

        </umb-editor-container>

        <umb-editor-footer>
            // footer content here
        </umb-editor-footer>

    </umb-editor-view>

And the controller:

angular.module("umbraco").controller("tnsConfig.items.EditController", 
function itemseditcontroller($scope, $routeParams, $http, notificationsService) {

    $scope.items = null;
    $http.get('/umbraco/api/TNSSearchConfig/GetCollection').success(function (response) {
        $scope.items = response;
    });

    $scope.promptIsVisible = false;

    $scope.cancelEdit = function () {
        $scope.id = null;
        $scope.name = null;
        $scope.doctype = null;
        $scope.dictionary = null;
    };

    $scope.abc = function () {
        alert($scope.name);
    };

    function saveItem() {
        if ($scope.id > 0) {
            //Edit
            $scope.name = null;
            $http.get('/umbraco/api/TNSSearchConfig/UpdateItem?id=' + $scope.id + '&name=' + $scope.name + '&docType=' + $scope.doctype +'&dictionary='+$scope.dictionary).success(function (response) {
                $scope.id = "";
                $scope.name = "";
                $scope.doctype = "";
                $scope.dictionary = "";

                notificationsService.success("Modification saved", "Succesfull save");
            })
                .error(function (data, status)
            {
                    notificationsService.error("Error during save", "Could not save data. Try again.");
            });
        }
        else {
            //Create new
        }
    }

    function confirmAction() {
            // confirm logic here
    }

    $scope.loadItemToEdit = function ($id) {
        $http.get('/umbraco/api/TNSSearchConfig/GetSearchDocTypeDictItem?id=' + $id).success(function (response) {
            $scope.id = response.id;
            $scope.name = response.name;
            $scope.doctype = response.documentTypeAlias;
            $scope.dictionary = response.dictionaryItem;
        });

    };

    //function showPrompt($id) {
    //  $scope.promptIsVisible = true;
    //      //alert($id);
    //}

    //function hidePrompt() {
    //  $scope.promptIsVisible = false;
    //}



});

I would be extremely happy if someone could help me to figure out what i'm doing wrong.

Many thanks in advance!

Regards, Istvan


Umbraco angular api

$
0
0

Hi, I'm reading the documentation regarding custom dashboards in Umbraco. I wanted to play around with it to learn more but I'm kind of stuck with this example.

My model looks like this:

angular.module("umbraco").controller("CustomWelcomeDashboardController", function ($scope, userService, logResource) {

    var vm = this;

    vm.UserName = 'guest';
    vm.UserLogHistory = [];

    var userLogOptions = {
        pageSize: 10,
        pageNumber: 1,
        orderDirection: "Descending",
        sinceDate: new Date(2017, 0, 1)
    };

    var user = userService.getCurrentUser().then(function (user) {
        vm.UserName = user.name;
    });

    logResource.getPagedUserLog(userLogOptions).then(function (response) {
        console.log(response)
        //vm.UserLogHistory = response;
    });
});

But I'm not getting any data in the browser console, instead I'm getting a console error http://localhost:50358/umbraco/backoffice/UmbracoApi/Log/GetPagedEntityLog?pageSize=10&pageNumber=1&orderDirection=Descending&sinceDate=Sun+Jan+01+2017+00:00:00+GMT+0100+(centraleuropeisk+normaltid)

Any ideas? My test looks just like the example?

Best regards

How to get the multiple IDs in Examine

$
0
0

Hi guys,

How can I get this three (3) ideas, and get their properties.

/// Umbraco/Api/Search/ComparisonKeyValues?ids=2874,2875,2876
public List<Compares> ComparisonKeyValues(string ids)
{
    // what should I put here...
}

Appreciate any help,

Thanks in advance,

Marky

Why does my code not work

$
0
0

I want to show all my project on one page. but it give me a null refence everytime i use the code to show all project. But when i add .Take(6) it works :D i dont get it. It worked earlier today. What do i do wrong ??

This one here it work with

 var selection = Model.Content.Site().FirstChild("projekter").Children().Where(x => x.IsVisible()).OrderByDescending(x => x.CreateDate).Take(6);

But this one her i dont. I get a nul reference

var blogItems = Model.Content.Children<Projekt>();

Here is the code i want to have to work :D

@inherits Umbraco.Web.Mvc.UmbracoTemplatePage
@using ContentModels = Umbraco.Web.PublishedContentModels;

@{
   var blogItems = Model.Content.Children<Projekt>();

}



<!-- Portfolio Grid -->
<section class="bg-light" id="portfolio">
    <div class="container">
        <div class="row">

            <div class="col-lg-12 text-center">
                <h2 class="section-heading text-uppercase">Projekter</h2>
                <h3 class="section-subheading text-muted">Vores projekter som vi er meget stolte af at vise dig.</h3>
            </div>
        </div>
        <div class="row">

            @foreach (var item in blogItems)
            {

                <div class="col-md-4 col-sm-6 portfolio-item">
                    <a class="portfolio-link" data-toggle="modal" href="@item.Url">
                        <div class="portfolio-hover">
                            <div class="portfolio-hover-content">
                                <i class="fas fa-plus fa-3x"></i>
                            </div>
                        </div>

                        <img src="@Umbraco.TypedMedia(item.GetPropertyValue<int>("billedeProjekt")).Url" style="width: 350px; height: 262px;" />


                    </a>
                    <div class="portfolio-caption">
                        <h4>@item.Name</h4>
                        <p class="text-muted">@Umbraco.Field("navnPaaProjekt")</p>
                    </div>
                </div>

            }
        </div>


    </div>
</section>

Tinymce not showing valid element

$
0
0

I want to add an onClick event to my div in the RTE but when i save it is deleted. I looked in my tinymceConfig and onclick was added in the valid elements. I also found the div tag and added the onclick attribute to it as well. But still it delets it. Can you help me.

This is my valid element in tinymceconfig

    <validElements>
    <![CDATA[+a[id|style|rel|data-id|rev|charset|hreflang|dir|lang|tabindex|accesskey|type|name|href|target|title|class|onfocus|onblur|onclick|
ondblclick|onmousedown|onmouseup|onmouseover|onmousemove|onmouseout|onkeypress|onkeydown|onkeyup],-strong/-b[class|style],-em/-i[class|style],
-strike[class|style],-u[class|style],#p[id|style|dir|class|align],-ol[class|reversed|start|style|type],-ul[class|style],-li[class|style],br[class],
img[id|dir|lang|longdesc|usemap|style|class|src|onmouseover|onmouseout|border|alt=|title|hspace|vspace|width|height|align|umbracoorgwidth|umbracoorgheight|onresize|onresizestart|onresizeend|rel|data-id],
-sub[style|class],-sup[style|class],-blockquote[dir|style|class],-table[border=0|cellspacing|cellpadding|width|height|class|align|summary|style|dir|id|lang|bgcolor|background|bordercolor],
-tr[id|lang|dir|class|rowspan|width|height|align|valign|style|bgcolor|background|bordercolor],tbody[id|class],
thead[id|class],tfoot[id|class],#td[id|lang|dir|class|colspan|rowspan|width|height|align|valign|style|bgcolor|background|bordercolor|scope],
-th[id|lang|dir|class|colspan|rowspan|width|height|align|valign|style|scope],caption[id|lang|dir|class|style],-div[id|dir|class|align|style|onclick],
-span[class|align|style],-pre[class|align|style],address[class|align|style],-h1[id|dir|class|align|style],-h2[id|dir|class|align|style],
-h3[id|dir|class|align|style],-h4[id|dir|class|align|style],-h5[id|dir|class|align|style],-h6[id|style|dir|class|align|style],hr[class|style],
dd[id|class|title|style|dir|lang],dl[id|class|title|style|dir|lang],dt[id|class|title|style|dir|lang],object[class|id|width|height|codebase|*],
param[name|value|_value|class],embed[type|width|height|src|class|*],map[name|class],area[shape|coords|href|alt|target|class],bdo[class],button[class],iframe[*]]]>
  </validElements>

Render media in Umbraco 8

$
0
0

What is the best way to render media (image) in a template using Umbraco 8? I can't get it to work and the documentation doesn't say much about it for version 8. At the moment I've tried:

nieuwsItem.Value("artikelAfbeelding");

Which returns an object called:

Umbraco.Web.PublishedModels.Image

When trying to get the URL of that image I get an error. I've tried getting the URL using: nieuwsItem.Value("artikelAfbeelding").Url; which returns an error. I presume this has to do with the new ModelBuilder in Umbraco 8, but I can't figure it out.

Is there any documentation that specifies how this should be done?

Thanks!

ParsePlaceHolders in custom workflow.

$
0
0

Hi Guys.

I'm slowly going nuts here..

I've created a custom workflow that has a property (amongst others), "Message", that I want to parse values as normal.

Somehow, this doesn't work! The "this.Message" property comes out as if it has allready parsed, since my property {firstName} isn't there.

If I look at this.Workflow.Settings i can see that the property initially contains this text {firstName}.

The record also has this property, but somehow it just isn't replaced.

I've tried applying this.Message.ParsePlaceHolders(), and as far as I know this works used to work like a charm..

Has something changed in relation to this? E.G are placeholders parsed "automatically" when I'm looking at the property this.Message inside my "Execute"-method?

a bit of code:

     string withRazorView = record.ParseWithRazorView("~/views/partials/" + this.RazorViewFilePath); //does this parse placeholders as well?
 if (!String.IsNullOrEmpty(this.Message))
            {
                string s = this.Workflow.Settings.Where(x => x.Key == "Message").FirstOrDefault().Value; //contains the {firstName]
                s = Umbraco.Forms.Data.StringHelper.ParsePlaceHolders(record, s); //seems to remove my placeholder
                withRazorView = withRazorView.Replace("<!--##MESSAGE##-->", "<p>" + s.ParsePlaceHolders().Replace(Environment.NewLine, "<br />") + "<p>"); //just removes my placeholder
            } 

I'm fairly sure this just "used to work", but somehow that isn't the case here..

system.web.http version mismatch

$
0
0

Hello everyone, i add a new plugin to umbraco and the c# code in App_Code folder always shows assuming assembly reference 'system.web.http, version=5.2.3.0' used by 'umbraco' matches identity 'system.web.http, version=5.2.6.0' of 'system.web.http' you may need to supply runtime policy

the application is running and working well but I would like to understand how to get rid of this

Thanks, Ronen


Umbraco Headless static site media urls.

$
0
0

Hi,

I have a .net core static route site, that is using using headless to get some content, this content is for locations, each node has a name, address, lat/long and some "promo images". I am having a major issue getting media items, that are using the media picker in the back office. I can add images to the node just fine, but when I access the node through code, all the image urls are relative, so I can't display them.

Has anyone solved this issue with headless? Does the site need to be a content managed site (with umbraco urls) for this to even be possible? The site is an Angular SPA, with umbraco headless being used just for content, and not to define url structure. Attempting to change the site to use umbraco urls is not something that can be considered.

Regards,

Edit

Here is the code grabbing the content from the headless instance,

var location = (await publishedContentService.GetAll<Location>()).FirstOrDefault(x => x.ExternalID == locationId);
foreach(var promo in location.PromoImages) //PromoImages is IEnumerable<ContentItem>
{
   //promo.Url exists, but is relative. e.g '/media/1001/image.png'
   var image = await mediaService.GetById(promo.Id);

  //image, of type MediaItem, has no url property.
}

this object has a collection called PromoImages, each of these is only showing a relative Url.

Control Panel Angular Version Upgrade

$
0
0

Hello everybody, im doing my umbraco plugin. I need angular 1.3 or higher. But umbraco using 1.1.5. How can i upgrade angular verison?

Customizing LocalLink internal links?

$
0
0

Hey.

Is it possible to customize how Umbraco renders internal links. In the RTE they look like "/{localLink:1592}".

On the website when displaying the content, the links get changed to their respective document. However, we need to add an extra URL part in front of the URL's.

For example /my/url/path/ needs to change to /fr/my/url/path/

Is this feasible somehow?

Thanks.

Preview vs Publish ?

$
0
0

I made a content change in Umbraco. When I preview it, I see the new content. When I publish those changes, I do not see the new content. This is the second time I've had this issue in as many days. Any ideas? It feels like a cacheing issue. Hard refreshing the page doesn't resolve the issue.

Concerns about members

$
0
0

Hello,

I have a task to create website with 2 types of member profiles ex. Standard profile and premium profile. This profiles after login can pick their categories and subcategories (one member can have many categories) created by admin in umbraco backofice. Also members should be able to create news.

So i have many concerns about it, i would be happy if someone can answer at least on one my question.

  1. What would be the best aproach to create this member type profiles? Would it be to create same member type for both and then put them in different member groups, than if someone upgrade from standard to premium I can just change his member group?

  2. What about categories? I was thinking to make it like this for admin: enter image description here

But then i dont know how to allow members to pick this categories in their profiles (i need directions about it pls).

  1. Than i dont have idea how to alow members to create news i think that it should be similar to 2nd question but I dont know how to connect members with document types and templates if that is possible.

I realy like Umbraco and i would like to do this project in it but i am a bit confused when it comes to members and their profiles.

Thanks

Stock Validation

$
0
0

Hey,

I'm currently in the process of building a TeaCommerce website that tracks stock for its products. I have everything setup in the backoffice but I'm struggling to find the best way to manage stock validation on the frontend.

For example when adding/updating a product to the basket, where and how should I validate the stock of that product during that workflow?

The only way I could see this working is using the OrderLineUpdating/Adding events to check the stock there and altering the user's quantity to ensure it's within the stock level. This however, doesn't seem like the best way as it's hard to inform the user of this automatic change. Alternatively, in some scenarios you might not want to alter their quantity, instead show an error message but I don't think it's possible to cancel the TC events from what I can tell?

Would be great to hear how others have managed this in the past with TC.

Cheers, Tom

Rendering custom properties in a template

$
0
0

Hey there,

I've created a custom property (addressFinder), with a valueType "JSON", and 3 properties in the JSON object (addressLatitude, addressLongitude, and locationAddress). Here's the package.manifest:

enter image description here

I'm using the data type in a document type called 'Office Location' where I'm wanting admin users to enter map locations that I'm going to use for a single Google map on another page.

I'm trying to render out an array of the location data from addressFinder on another page (a document type called 'Map'), and was just wondering how I access the stored JSON data? I'm actually using a partial view macro file within a page, but I'm assuming it's the same syntax.

I tried both of the following to no avail (just to see if I could get a value printed out):

enter image description here enter image description here

Is anyone able to point me in the right direction in terms of accessing the fields within my JSON object?

Many thanks,

Victoria


umbraco 7 not working no goaddy shared server.

$
0
0

Hi ,

I have purchase shared goaddy hosting space for umbraco 7 website(http://sunil.vjdigitalsolution.com/) when upload and run its .it not working on that server. Note:- it is possible to run Umbraco website on Goaddy shared server.

Vorto in Leblender

$
0
0

Can anyone explain that how to use Vorto (Multilingual Package) in Leblender Editor?

  1. I have created a Vorto Data Type and use it in Leblender Editor as a property. enter image description here

  2. When i go to content Grid editor and open Vorto Section then it didn't display fields and look like below. enter image description here

Any suggestions/help will be highly appreciated. Thanks

trying to create a custom workflow.

$
0
0

Hi, I am trying to create a custom workflow(I am totally lost how to do it), for a form that I have. I want the workflow to be able to redirect the user to a page based on which radiobutton they have selected on the form.

For example. if the user select the first radio button, they would be redirected to the homepage or if they selected the second button they would be redirected to an external page on submit.

Integrate umbraco user management

$
0
0

I am looking for someone who can integrate umbraco user management with external database

Different color scheme Umbraco 8 Aplha backoffice?

$
0
0

Hello,

I've installed Umbraco version 8.0.0-alpha.58.2216 via nuget. The first thing i've noticed is that the colors of the backoffice look different. There's pink used for tabs and buttons.

Is this to tell users that it is a alpha version or is this the new color scheme for Umbraco 8?

Viewing all 72689 articles
Browse latest View live


<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>